//Using cin.clear() to ignore any trailing newline character string str; cin.clear(); getline(cin, str);