Question: Implement myecho.cpp so that when passed 0 or more strings, each separated by at least once space, those strings are printed on the screen with

Implement myecho.cpp so that when passed 0 or more strings, each separated by at least once space, those strings are printed on the screen with exactly one space between them. For example:

> ./myecho Welcome to Linux! Welcome to Linux!  ./myecho Welcome to Linux! Welcome to Linux!  ./myecho 

The sample output uses the Fish shell, and we recommend you use that. Otherwise, you might get slightly different-looking output.

Q2.

To the version of ./myecho you wrote in the previous question, add support for a -h flag that prints the help message given below and exits (ignoring any strings that come after the -h).

The help message should look like this:

 ./myecho -h Usage: ./myecho [-runtests|-(hrs)] [string ...] -runtests: run the tests over-rides single-character flags -h: print this help message over-rides other single-character flags -r: print the strings in reverse order -s: no space between arguments -q: quote the printed results -rs, -sr: no space between arguments, in reverse order Repeated single-character flags are allowed (and are ignored). Unknown flags cause an error. Examples:  ./myecho -q ""  ./myecho x y z x y z  ./myecho -q x y z "x y z"  ./myecho -sr x y z zyx  ./myecho -h

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!