-
Returning Actual Seconds
I'm trying to code a small program that acts as a 'quasi' timer.
In the middle of the screen I need the Time HH:MM:SS
to be refreshed every second. Starting at 00:00:00.
Any ideas on where to begin ?
Or does anyone have some sample code
they wouldn't mind sharing.
..This Program is out of Curiosity..
-
Code:
#include <iostream>
using std::cout;
#include <unistd.h>
int main ()
{
int sec = 0;
while (1) {
cout << sec++ << '\r';
sleep (1);
}
return 0;
}
that's one easy way to count seconds. i'm sure there's a way to sleep with windows. i just can't remeber the header file. that should get your started, right?