/ Published in: C
My homework :)) from university
Expand |
Embed | Plain Text
#include <stdio.h> #include <stdlib.h> #include <windows.h> #include <time.h> void clock(void); int main(void) { clock(); return 0; } void clock(void) { int s, m, h; system("color F5"); time_t rawtime; struct tm * timeinfo; char buffer_s [80]; char buffer_m [80]; char buffer_h [80]; time ( &rawtime ); timeinfo = localtime ( &rawtime ); strftime (buffer_s,80,"%S",timeinfo); strftime (buffer_m,80,"%M",timeinfo); strftime (buffer_h,80,"%H",timeinfo); s = atoi(buffer_s)+1; m = atoi(buffer_m); h = atoi(buffer_h); while ( s < 61 ) { system("cls"); if ( s == 60 ) { ++m; s = 0; if ( m == 60 ) { m = 0; ++h; if ( h == 24 ) { h = 0; } } } else { ++s; } Sleep(1000); } }
Comments
Subscribe to comments
You need to login to post a comment.

Cool! Wanted to do this for a long time! Thanks!
http://illuminatedmirror.org