+ 6

How to use waiting in c++ ????

I want to stop my code for 20 seconds.... by doing like processing or wating.... I tried header file <time.h> but problem is It didn't work or I don't know how to use... help.... thank you in advance...

1st Jan 2017, 6:50 AM
Prabin Chandra Shrestha
Prabin Chandra Shrestha - avatar
3 Respostas
+ 5
Instead of using time you can use dos.h header file. Here is an example of code : #include <iostream.h> #include <dos.h> void main () { delay (20000); cout<<"This line will displayed after 20 seconds"; getch (); } Here delay function uses dos header file. value 1000 in delay means 1 seconds Therefore to delay it 20 seconds we have entered 20000.
1st Jan 2017, 7:04 AM
Naveen Kumar
Naveen Kumar - avatar
+ 4
thankx I will try this...
3rd Jan 2017, 4:38 PM
Prabin Chandra Shrestha
Prabin Chandra Shrestha - avatar
+ 2
It works in IDE, but not in sololearn's code playground.
1st Jan 2017, 7:00 AM
Wen Qin
Wen Qin - avatar