Question
In this programming assignment, you need to write C++ program that serves as a very basic word processor. The program should read lines from a
In this programming assignment, you need to write C++ program that serves as a very basic word processor. The program should read lines from a file, perform some transformations, and generate formatted output on the screen.
For this assignment, use the following definitions:
?A "word" is a sequence of non-whitespace characters.
?An "empty line" is a line with no characters in it at all.
?A "blank line" is a line containing only one or more whitespace characters.
?The "line length" is the number of characters in each line to be displayed in the output. The line length for each output line may be specified as a command line argument.
?A "paragraph" is a collection of lines. There are no blank lines or empty lines in a paragraph.
?An "indent" includes spaces at the very beginning of the first line of a paragraph. The number of spaces to indent each paragraph may be specified as a command line argument.
?"Line spacing" is the space between each line in a paragraph (e.g., single spaced)
?"Paragraph spacing" determines the amount of space above or below a paragraph. Assume the paragraph space is equal to the line spacing
plus one.
?"Word count" is the number of words allowed in a document.
?"End of a paragraph" is defined as one or more consecutive empty or blank lines, or the end of file. The program performs the following transformations:
1.The program writes words in the output separated by a single whitespace character. So, for example, the input "Hello world" should appear as "Hello world" in the output.
2.The output lines must be filled out to a length less than or equal to the specified line length. This may involve combining several lines of input into a single line of output. Note that the length of the output line should not exceed the line length. The only exception to this rule is if there is only a single word to be displayed on the outputline.
3.Whitespace at the beginning and end of a line of input should be ignored.
4.The first line of each paragraph is indented the number of spaces specified.
5.Paragraph lines are written in the output separated by the specified line spacing.
6.Paragraphs are written in the output separated by the specified line spacing plus one. Several consecutive empty or blank lines in the input file should cause a single empty line to be generated on output by default (i.e. single spaced).
7.The program will limit the number of words read from the input file to the specified maximum number of words.
8.The program at the end prints the maximum allowed number of words and the word count:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started