There are some ridiculous things in C++, like the fact that there exists getc(), getch(), getche(), getchar(), and _getch() and they’re all different. Press Enter to Continue getch
If you’re doing cin of an integer, and the user enters a character, they’ll get stuck in an infinite loop. I found a good way to fix this at bytes.com
There are several possible ways to remove the unwanted
characters. Here’s one:cin.clear(); /* reset stream state to ‘good’ */
cin.ignore(numeric_limits<streamsize>::max(), ‘\n’);This means: “extract and discard all characters up
to the first newline character, or the maximum possible
number of characters in a stream, whichever occurs first.”You’ll need to add:
#include <limits> // for declaration of ‘numeric_limits’
#include <ios> // for declaration of ’streamsize’