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, 22.06.2019 10:30
You are almost finished updating a web site. as part of the update, you have converted all pages from html 4.0 to html5. the project is currently on schedule. however, your project manager has been asked by the marketing team manager to justify a day of time spent validating the site's html5 pages. the marketing team manager does not have technical knowledge of the internet or the web. which is the most appropriate explanation to provide to the marketing team manager?
Answers: 1
question
Computers and Technology, 22.06.2019 12:30
An atom's diameter is about 0.1 nanometer (1Ă—10-9m), and a human hair is about 1Ă—10-3m. how many times greater is a human hair than an atom's diameter? sorry pushed wronf button but this is math
Answers: 3
question
Computers and Technology, 24.06.2019 13:30
Which of the following is not a “fatal four” event?
Answers: 2
question
Computers and Technology, 24.06.2019 17:40
Anewly established internet company with 40 employees needs your advice. they are looking for a collaboration tool and have narrowed their choices to gotomeeting, webex, and my web conferences. after reading the information presented in this chapter and other sources, prepare a two- page document ( double spaced) that includes two advantages and two disadvantages of each tool. which one is your final recommendation? why did you choose that tool over the other two?
Answers: 3
You know the right answer?
For this C++ assignment, we define three types of "reversal"
A "line" reversal reverses the
Questions
question
Social Studies, 29.08.2019 11:10
question
Mathematics, 29.08.2019 11:10
question
English, 29.08.2019 11:10
question
Mathematics, 29.08.2019 11:10
Questions on the website: 13722361