#include<stdio.h>
#include<conio.h>
#include<time.h>
struct time {
int h, m, s;
};
void updatetime( struct time );
void updatetime( struct time nutym )
{
++nutym.s;
if( nutym.s == 60) {
nutym.s = 0;
++nutym.m;
if(nutym.m == 60) {
nutym.m = 0;
++nutym.h;
if(nutym.h == 24)
nutym.h = 0;
}
}
}
main()
{
struct time timecurrent;
printf("Enter the time (hh:mm:ss):\n");
scanf("%d:%d:%d", \
&timecurrent.h,&timecurrent.m,&timecurrent.s);
updatetime ( timecurrent);
printf("The new time is %02d:%02d:%02d\n",timecurrent.h, \
timecurrent.m, timecurrent.s);
getch();
main();
}
No comments:
Post a Comment