how to create a while loop for 24 hours?
You mean a loop that loops 24 times?
Think about what kind of condition would make the loop end.
Last edited on
no a loop that loops 24 hours
I guess
1 2 3 4
|
#include <ctime>
...
time_t start = time(0);
while ( difftime( time(0), start ) < 60*60*24 ) { ... }
|
Why would you want to do this though?
Last edited on
oh thank you but isnt the time(0)
return hours? if yes the it should be like while ( difftime( start, time(0) ) < 24 ) { ... }
never mind it returns seconds
Last edited on