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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:30, studybug2306
Jason needs to learn a new web tool. he went through his books to understand more about it. now he wants hands-on experience with using that tool. what would him? jason can use websites where workspace is provided to test the results of your code.
Answers: 2
image
Computers and Technology, 23.06.2019 04:31, legendman27
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, cdavis379
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a. if the manual switch s is on, then the light l is on. b. besides the manual switch, there is a motion detector, m1, which activatesthis light. c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d. the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, rscvsdfsrysas3712
Why is an outfitting a workspace with video games in a technology development company considered a strategic use of money
Answers: 1
You know the right answer?
For this C++ assignment, we define three types of "reversal"
A "line" reversal reverses the

Questions in other subjects: