#include <stdio.h>
#include <stdlib.h>
int main()
{
int h1, h2, m1, m2, s1, s2, t1, t2, t;
int h, m, s;
scanf("%d:%d:%d", &h1, &m1, &s1);
scanf("%d:%d:%d", &h2, &m2, &s2);
t1 = 3600 * h1 + 60 * m1 + s1;
t2 = 3600 * h2 + 60 * m2 + s2;
if(t1 > t2)
{
t = t1 - t2;
}
else
{
t = t2 - t1;
}
h = t / 3600;
m = t / 60 % 60;
s = t % 60;
printf("%02d:%02d:%02d",h, m, s);
return 0;
}
C语言实验——时间间隔
最新推荐文章于 2023-12-20 14:48:11 发布