51 lines
479 B
C
51 lines
479 B
C
#include <stdio.h>
|
|
#include <conio.h>
|
|
#include <dos.h>
|
|
#include <pc.h>
|
|
|
|
void main(void)
|
|
{
|
|
int h, m, s, ms, col;
|
|
|
|
/* Init values */
|
|
h = 0;
|
|
m = 0;
|
|
s = 0;
|
|
ms = 0;
|
|
col = 0;
|
|
|
|
for(;;)
|
|
{
|
|
if(kbhit())
|
|
{
|
|
getch();
|
|
exit(0);
|
|
}
|
|
|
|
printf("%dh%dm%ds.%dms",h,m,s,ms);
|
|
if( (++col % 1) == 0) printf("\r");
|
|
|
|
ms++;
|
|
if(ms > 99)
|
|
{
|
|
ms = 0;
|
|
s++;
|
|
}
|
|
|
|
if(s > 59)
|
|
{
|
|
s = 0;
|
|
m++;
|
|
}
|
|
|
|
if(m > 59)
|
|
{
|
|
m = 0;
|
|
h++;
|
|
}
|
|
|
|
delay(100);
|
|
}
|
|
}
|
|
|