|
cin.clear () repairs the broken stream. It does NOT remove any characters that were left in the stream, unconsumed. Add cin.sync () for that. You can use things like getch if you're satisfied with producing non-portable code when there's no need for it. Seems like a bad idea, though.
|