Originally Posted by
Daved
If you are using cin >> to get your input, you have to ignore leftover characters in the stream, otherwise cin.get() just gets those characters. The simplest way to do this is to add a cin.ignore(); above the cin.get(); to ignore the newline character from when the user hits enter.
You can instead add a cin.ignore(); after every call to cin >>, which will help if and when you use getline. Also, if you want to do good error handling, which most new programmers gloss over, you can #include <limits> and use
cin.ignore(std::numeric_limits<std::streamsize>::m ax(), '\n');
which will ignore everything left in the stream, even if the user types in extra stuff that you don't need.