#include #include using namespace std ; int main() { string str1 ; cout << "Enter your name." ; cin >> str1 ; cout << str1 << endl ; //Reads the second word cin >> str1 ; cout << str1 << endl ; cout << (int)cin.peek() << endl ; // cin.get() ; //Another way //read and discard up to 100 characters from //the input buffer, or until a newline is read cin.ignore(100, '\n') ; //resets any error flags in the cin stream cin.clear() ; cout << "Enter your name again1." ; getline ( cin, str1 ) ; cout << str1 << endl ; cout << "Enter your name again2." ; getline ( cin, str1 ) ; cout << str1 << endl ; return 0; }