A similar question for Python was asked.
How to ignore user input during sleep in Python 3?
How would I do that in C++? I am using this sleep command, and would prefer to keep using it.
this_thread::sleep_for(chrono::seconds(4));
However, it still will collect user input, which causes the user to miss important text they skip over. How can I prevent this?
Input as in Keyboard input using:
_getch();
This is a console application.
cout << "Wait 4 Seconds";
this_thread::sleep_for(chrono::seconds(4));
cout << "More text here!";
cout << "\n Press any key to go on";
_getch();
AFTER ANSWER EDIT Final Code would look like this:
cout << "Wait 4 Seconds";
this_thread::sleep_for(chrono::seconds(4));
while (_kbhit())
{_getch();}
cout << "More text here!";
cout << "\n Press any key to go on";
_getch();