Sleep function compile but it does not work in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Sleep function compile but it does not work in c++

I tried to add some animation with c++ but sleep function does not work : cout << "solo"; sleep(1); cout<< "learn"; this code print directly sololearn and no wait. is it a sololearn application limitation ? any idea ?

30th Jun 2017, 2:48 PM
Chokri ZAGROUBA
Chokri ZAGROUBA - avatar
1 Answer
+ 3
If I'm not mistaken the Sleep function expects the passed argument in milliseconds, so if 1000 was passed in, there will be a one second delay. In the code the argument is 1 millisecond, that's 1000th a second. I could be wrong though, besides it was under Windows, probably in winbase.h.
6th Jul 2017, 12:26 PM
Ipang