I have a simple code as below.
int a, b;
cin >> a >> b;
If the user only inputs one number, the program will hang there waiting for another input. How do I stop the situation automatically and let the user to enter two numbers again if there is no input for a time, like 30 seconds?