I would like my program to only move forward when the enter key is pressed (not any other key).
This is what I have so far:
while (getline(in, line) ) {
cout << line << endl;;
cin.ignore();
}
I would like my program to only move forward when the enter key is pressed (not any other key).
This is what I have so far:
while (getline(in, line) ) {
cout << line << endl;;
cin.ignore();
}
ignore
accepts a delimiter argument:
basic_istream& ignore( std::streamsize count = 1, int_type delim = Traits::eof() );
You can use it like this:
cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');