简约版计算时间差
#include <stdio.h>
int main()
{
int hour1,minute1;
int hour2,minute2;
printf("please input the first hour and minute:\n");
scanf("%d %d",&hour1,&minute1);
printf("please input the second hour and minute:\n");
scanf("%d %d",&hour2,&minute2);
int ih=hour2-hour1;
int im=minute2-minute1;
if(im<0){
im=60+im;
ih--;
}
printf("时差是%d小时%d分钟\n",ih,im);
return 0;
}