i don't like the indentation of lines 10--13, second snip
you should use
cerr to output error messages
> most consoles let you simply press the up arrow to retype the previous input
¿they do?
> Like "123 456abc 789"? Well, we can apply the same line-by-line thinking here too:
> break up the string into multiple strings, separated by spaces, and then process each one individually.
a- Read a line from cin as an string
b- Convert the string to an istringstream
c- Read a word from the istringstream as an string
d- Convert the string to an istringstream
e- Read a number
I don't think that you need steps c and d. After all, you can screw the stringstream as much as you want..
(step e would be a loop)
> then the input operation will fail without changing the variable you were inputting into
iirc, that was the previous standard. Now numbers are set to 0 in case of failure, and char arrays would be "empty".
you may want to explain why getline() is inside the loop
¿Not one mention to
readline() ?
http://linux.die.net/man/3/readline (or a c++ equivalent)