把改答桥编完成逗悔的完整程序发给你,已经运行过,如果有什么问题请留言。
#include
struct TIME
{
int hour;
int minute;
int second;
};
struct TIME format(struct TIME *p,int s)
{
(*p).second=s%60;
(*p).minute=s/60%60;
(*p).hour=s/3600;
return *p;
}
void display(struct TIME *p)
{
printf("%2d:%2d:%2d\n",(*p).hour,(*p).minute,(*p).second);
}
void delay()
{
int t;
for(t=0;t<100000000;t++);
}
int main()
{
int 山举正i;
struct TIME tim;
for(i=0;i<1000000;i++)
{
tim=format(&tim,i);
display(&tim);
delay();
}
return 0;
}
void update()
{
int t;
second++;
t=second/谨悉渣60;
second %= 60 ;
minute += t;
t=minute/祥悄陆银60;
minute %= 60 ;
hour =(hout+t)%24 ;
}