#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include <windows.h>
int main(void)
{
int begin_h, begin_m, begin_s, end_h, end_m, end_s,time,t,m,s;//开始h m s 结束h m s 存放秒数 差值 h m s
puts("请输入开始时间");
scanf("%d%d%d", &begin_h, &begin_m, &begin_s);
puts("请输入结束时间");
scanf("%d%d%d", &end_h, &end_m, &end_s);
time = (end_h * 3600 + end_m * 60 + end_s) - (begin_h * 3600 + begin_m * 60 + begin_s);//先全部转化为s
t = time / 3600;//几小时
time -= t*3600;
m = time / 60;//几分钟
time -= m* 60;//几秒
s = time;
登录后提交答案