0
Is there a function for delay in Sololearn, Windows.h does not work
2 Respostas
+ 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;
}
+ 2
we cannot delay or pause code execution on c++ playground