Is there a simple way to allow user input without having the program "wait" for it?
For example, I want to write a function that counts down from 100 to 0. The only way to stop it would be if the user enters a certain phrase. I want to make sure that the count down is absolutely uninterrupted unless the exact phrase is entered.
So, how would I have a variable ready to be changed by the user, and also a function running at "the same time" so to speak?
Here's some mock code for what I can come up with so far.
So that's the basic idea of what I want, except in that example, the function will pause every time and "wait" for input right?
for (int i = 100; i > 0; i--)
cin >> password;
if (password != 'stop')
// pause for 1 second
cout << i << "..." << endl;