how do you use C++ sleep time function the same way python uses ( time.sleep(2) )...plz help!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how do you use C++ sleep time function the same way python uses ( time.sleep(2) )...plz help!!!

C++ sleep time function

10th Apr 2017, 10:45 AM
Donald Chinhuru
Donald Chinhuru - avatar
2 Answers
+ 8
#include <iostream> #include <windows.h> int main() { std::cout << "Hello "; Sleep(1000); std::cout << "World."; return 0; } // pauses output after "Hello " for 1000ms
10th Apr 2017, 11:22 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
sleep(unsigned int) the (unsigned int ) is an integer in milisecond. sleep(1000) : waits for 1 second you should mention #include<time.h> too
10th Apr 2017, 11:00 AM
Sagheb
Sagheb - avatar