subject

For this C++ assignment, we define three types of "reversal"
A "line" reversal reverses the
entire line. In a line reversal,
"Hello world!" becomes "!dlrow olleH"
A "word" reversal reverses each word. In a word reversal,
"Hello world!" becomes "olleH !dlrow"
A "lineword" reversal performs a line reversal and a word reversal. In a lineword reversal,
"Hello world!" becomes "world! Hello".
No matter how many spaces between words in the input, the output should have only one space after each word. So a line reversal of
"Hello world!" becomes "!dlrow olleH"
The program is told which type of reversal to perform by providing a single command line argument, "line", "word", or "lineword".
If no command line arguments are provided, the program should print "MISSING FLAG" and stop.
If an unrecognized command line argument is provided, the program should print "UNKNOWN FLAG" followed by the unrecognized argument, and stop.
If more than one command line argument is provided, the program should print "TOO MANY FLAGS" and stop.
Hints:
1. your input to the program is lines read from standard input
2. the best way to structure the program is to interpret the command line arguments, remembering what was specified, THEN loop reading lines and performing the specified reversal
3. IF you see a message about binary file detected, it's probably because you printed out a null character. This is likely caused by an off-by-one error. If you reversed the line by looping through the input string, starting at the end and looping to the beginning, that's probably the error. Remember if the string is of length X, the characters go from 0 ... X-1. SO... don't start your loop at X, or you're reading past the end of the string.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 13:00
Which one of the following voltages should never be measured directly with a vom? a. 1200 v b. 500 v c. 800 v d. 100v
Answers: 2
question
Computers and Technology, 23.06.2019 21:40
Draw the resistor’s voltage and current phasors at t=15ms. draw the vectors with their tails at the origin. the orientation of your vectors will be graded. the exact length of your vectors will not be graded.
Answers: 2
question
Computers and Technology, 24.06.2019 07:00
Selective is defined as paying attention to messages that are consistent with one’s attitudes and beliefs and ignoring messages that are inconsistent.
Answers: 1
question
Computers and Technology, 24.06.2019 10:10
Which view in a presentation program displays a split window showing the slide in the upper half and a blank space in the lower half?
Answers: 1
You know the right answer?
For this C++ assignment, we define three types of "reversal"
A "line" reversal reverses the
Questions
question
Arts, 15.09.2021 14:50
question
Mathematics, 15.09.2021 14:50
question
Mathematics, 15.09.2021 14:50
Questions on the website: 13722363