Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdio.h>
- void printTimeFromSeconds (unsigned x)
- {
- unsigned h,m,s;
- h=x/3600;
- x=x-h*3600;
- m=x/60;
- s=x%60;
- printf("%d:",h);
- if (m<10) printf("0%d:",m);
- else printf("%d:",m);
- if (s<10) printf("0%d ",s);
- else printf("%d ",s);
- }
- void getTimes ()
- {
- unsigned h=0,m=0,s=0;
- unsigned winTime=0,actualTime=0,previousTime=0;;
- scanf("%d:%d:%d",&h,&m,&s);
- winTime=h*3600+m*60+s;
- printTimeFromSeconds(winTime);
- putchar('\n');
- previousTime=winTime;
- while (scanf("%d:%d:%d",&h,&m,&s)==3)
- {
- actualTime=h*3600+m*60+s;
- putchar('+');
- printTimeFromSeconds(actualTime-previousTime);
- printTimeFromSeconds(actualTime-winTime);
- putchar('\n');
- previousTime=actualTime;
- }
- }
- int main()
- {
- getTimes();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement