Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am just a beginner of C++ and trying to get a simple function done.

Lets say i have these first 3 lines:

int age;
cout<<"please enter your age"<<endl;
cin>>age;


I want this function to wait for 30 seconds, if there is any input of integer, function A is executed, else there is no input by the user and the time is up, function B is executed.

I know the function sleep works well for waiting, but the program waits until there is input, not stopping after 30 seconds.

Please help, thank you.
Posted

1 solution

It's actually not as simple as one would think, maybe this link[^] will help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900