How do I clear the cin buffer in C++?
The following should work:
cin.flush();
On some systems it's not available and then you can use:
cin.ignore(INT_MAX);