1
I did a little research on, but I just find solutions spliced in C, but I use C++. The doubt is basically what the title says, whether it is possible to limit the time until the user input the cin
.
cout << "Você tem 5 segundos para digitar algo";
cin >> input.
In this case, if the user enters something in up to 5 seconds, the input is recorded and the code goes to X place, otherwise something else happens and the code goes to Y place.
Create a child process, through Fork(), and fire a stopwatch that will end the program. If any input is entered in the parent process the process will terminate the stopwatch process (child).
– anonimo
Specifically for C++ study the thread class.
– anonimo