#include<stdio.h> #include<string.h> #include<math.h> struct time { int hour; int min; int miao; }t[2]; int main() { scanf("%d:%d:%d", &t[0].hour, &t[0].min, &t[0].miao); scanf("%d:%d:%d", &t[1].hour, &t[1].min, &t[1].miao); long int a = (3600 * t[0].hour + 60 * t[0].min + t[0].miao); a = fabs(a - (3600 * t[1].hour + 60 * t[1].min + t[1].miao)); struct time tim; tim.hour = a / 3600; tim.min = a % 3600 / 60; tim.miao = a % 3600 % 60; printf("%d:%02d:%02d\n", tim.hour, tim.min, tim.miao); } |
Double click to view unformatted code.