cin
std::ws on cin to get rid of whitespace. What happens if you take out that line of code? Experiment by commenting this out and seeing what happens.
Now try "Ann Marie" as the first name, and "Fitzpatrick" as the last name. Does the program work the way you would want it to?
Try the same thing with "Billy Bob" as the first name, and "Thornton" as the last name.
Notice that the program does not appear to work properly. Fix the program by using the cin.getline function in the proper spot.
g++ cmdLine.cpp ./a.outThen try running it with
g++ -o cmdLine cmdLine.cpp ./cmdLineHow is the output different? Look at the output, then read through the source code, and see if you can figure out what is going on.
./cmdLine help ./cmdLine repeat 5 Hello There! ./cmdLine foobar
In each case, look through the source code and try to understand what is happening.
./cmdLine reverse This is a testshould produce output:
test a is This