C++ cin Ignoring the Enter key after the first character is read
#include <iostream> using namespace std; int main()//w ww . j a v a 2 s . co m { char fkey, skey; cout << "Type in a character: "; cin.get(fkey); cout << "The key just accepted is " << int(fkey) << endl; cin.ignore(); cout << "Type in another character: "; cin.get(skey); cout << "The key just accepted is " << int(skey) << endl; cin.ignore(); return 0; }