Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:30, juliangarcia0002
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
image
Computers and Technology, 22.06.2019 23:30, brainbean
Select all that apply. which of the following are proofreading options included in microsoft word? spell check find replace grammar check formatting check
Answers: 1
image
Computers and Technology, 24.06.2019 07:00, sudotoxic
Into what form does the barcode reader convert individual bar patterns?
Answers: 1
image
Computers and Technology, 24.06.2019 13:30, andybiersack154
Consider jasper’s balance sheet. which shows how to calculate jasper’s net worth?
Answers: 1
Do you know the correct answer?
For this C++ assignment, we define three types of "reversal"
A "line" reversal reverses the

Questions in other subjects: