Question: Program description Sample input file : Sample output file : Write a simple text-formatting program that reads a text file and produces another text file

Program description  Program description Sample input file : Sample output file : Write
Sample input file :
a simple text-formatting program that reads a text file and produces another
Sample output file :
text file in which blank lines are removed, multiple blanks are replaced

Write a simple text-formatting program that reads a text file and produces another text file 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 file, but do not break any words or put punctuation marks at the beginning of a new line A sample run to format a text file Lincoln.txt to a new text file 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 Note You need to input the given length (between 1 and 72) from keyboard. Your program should check if you can successfully open files for read and write. Download the test input file: Lincoln.txt and compare you output file with the correct output file Formatted.txt, to verify your program. Hint Read from the input file 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!