Question: Using C++ write a simple text-formatting program that reads a text le and produces another text le in which blank lines are removed, multiple blanks

Using C++ write a simple text-formatting program that reads a text le and produces another text le in which blank lines are removed, multiple blanks are replaced with a single blank, and no lines are longer than some given length. Put as many words as possible on the same line. You will have to break some lines of the given le, but do not break any words or put punctuation marks at the beginning of a new line. A sample run to format a text le Lincoln.txt to a new text le Formatted.txt is: Please enter the name of the input file containing unformatted text: Lincoln.txt Please enter the name of the output file to contain formatted text: Formatted.txt Please enter maximum length of line (1 72) 40 Press any key to continue You need to input the given length (between 1 and 72) from keyboard. Your program should check if you can successfully open les for read and write. Download the test input le: Lincoln.txt and compare you output le with the correct output le, Formatted.txt , to verify your program. Read from the input le word by word. Keep track of the number of characters, which is used to decide when to make a new line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!