Preventing User Input from Keyboard
I'm writing a program in which I want the program to stop at certain points and wait for the user to press Return before continuing.
So far I've tried cin.get() and cin.getline(), but these have proven unsatisfactory because if the user presses anything other than Return, the program advances too fast.
I've tried using things like cin.ignore() and cin.clear() but they don't work, and when they do it's incredibly untidy and reliant on the user not typing much when he shouldn't.
What I really want is a way to prevent the user typing anything except enter, or preferably a way to scan what's been typed before it gets to the screen, and allow it through only if it's one of a few allowable characters (ie, '\n' or numbers 1 - 5 for choosing one of several options.)
Any help would be greatly appreciated.