|
|||
Line WrappingCreate a program that can be used to split the input lines after every 20th character. If a line is not longer than 20 characters, then it must appear in the output as it is. Sample Input
Output for Sample Input
Hints and GuideThis exercise does not really differ from a simple echo program. The only difference is that we need to print an extra newline after every twentieth character counted from the beginning of the line. It requires a single counter that must be reset to zero every time a newline character is read from the standard input or when the counter reaches 20. One possible solution is available in: main.c. Possible ImprovementsNote that processing the input character by character can be very slow. A character buffer and the use of the
Acknowledgement
This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|
|||
University of Debrecen; Faculty of Informatics; v. 03/01/2019 |