Program could use some protection against invalid input, along the lines of
if(!(cin >> n1 >> n2 >> n3)) { ndone=false; }
and if you really wanted to get fancy you could throw in an error message when it occurs
it’s not nice to have a program that goes into an infinite loop if you give it a letter instead of a number
wow, I didn’t know iostream was that badly broken.
Fixed, though it now aborts completely if you give it a letter.
It could be worse. The C++ keyboard console input libraries are, indeed, horrible—but you could be stuck trying to do the same thing in plain old C. ::shudders::
Program could use some protection against invalid input, along the lines of
and if you really wanted to get fancy you could throw in an error message when it occurs
it’s not nice to have a program that goes into an infinite loop if you give it a letter instead of a number
wow, I didn’t know iostream was that badly broken.
Fixed, though it now aborts completely if you give it a letter.
It could be worse. The C++ keyboard console input libraries are, indeed, horrible—but you could be stuck trying to do the same thing in plain old C. ::shudders::