0

Is there a function for delay in Sololearn, Windows.h does not work

https://code.sololearn.com/cqHiY8np45Wa/?ref=app

12th Aug 2023, 1:09 PM
UJCoder
UJCoder - avatar
2 Answers
+ 4
#include <iostream> #include <unistd.h> #include <sys/time.h> using namespace std; int main() { timeval start, end; gettimeofday(&start, 0); cout << "Hello "; sleep(0.8); cout << "World" << endl; gettimeofday(&end, 0); cout << "start-time\t" << start.tv_sec << ':' << start.tv_usec << endl; cout << "end-time\t" << end.tv_sec << ':' << end.tv_usec << endl; return 0; }
12th Aug 2023, 3:01 PM
JaScript
JaScript - avatar
+ 2
we cannot delay or pause code execution on c++ playground
12th Aug 2023, 1:39 PM
Lisa
Lisa - avatar