+ 6

C++ Timers in sololearn

Hi all After I run this, loop counts to 3 and stops for time limit error also it prints all at once not in every 1000 milliseconds. I tried to use <chrono> and <thread> but it seems <thread> is not supported by sololearn. Quesestion is , How can I print values every 1000 millisecond (here) ? #include <Windows.h> #include <iostream> using namespace std ; int main() { for(int x = 0 ; x < 10; x++){ Sleep(1000); cout << x << endl; } }

29th Aug 2017, 11:23 AM
Jetset Willy
Jetset Willy - avatar
2 Respuestas
+ 8
no timers will work here the way you want to use them. everything is compiled on the server. we only see the final output. thus all inputs must be entered at runtime
29th Aug 2017, 11:43 AM
jay
jay - avatar
+ 5
Thanks.
29th Aug 2017, 12:00 PM
Jetset Willy
Jetset Willy - avatar