Display a software timer
#include <stdio.h>
#define DELAY 128000
struct my_time {
int hours;
int minutes;
int seconds;
} ;
int main(void)
{
struct my_time systime;
if(systime.seconds==60) {
systime.seconds = 0;
systime.minutes++;
}
if(systime.minutes==60) {
systime.minutes = 0;
systime.hours++;
}
if(systime.hours==24)
systime.hours = 0;
printf("\n%02d:", systime.hours);
printf("\n%02d:", systime.minutes);
printf("\n%02d\n", systime.seconds);
return 0;
}
Related examples in the same category