`#include <stdio.h>
#include <math.h>
int main(void)
{
int hour1,minute1;
int hour2,minute2;
printf(“Input time one(hour, minute):”);
scanf("%d,%d",&hour1,&minute1);
printf(“Input time two(hour, minute):”);
scanf("%d,%d",&hour2,&minute2);
int t1=hour160+minute1;
int t2=hour260+minute2;
int t3=abs(t1-t2)/60;
int t4=abs(t1-t2)%60;
printf("%d hour %d minute\n",t3,t4);
return 0;
}
学习心得:1.时间的转化,将1.25hohr转化为hour1*60+minute。2.abs在Int整数型和fabs在float浮动型的区别。3./60求整数和%60求余数