C-study/08/1/1.c

27 lines
427 B
C
Raw Normal View History

#include<stdio.h>
typedef struct Time{
int h;
int m;
int s;
}time;
int main(){
int s;
time data;
scanf("%d:%d:%d",&data.h,&data.m,&data.s);
scanf("%d",&s);
data.s+=s;
if(data.s/60>=1){
data.m += data.s / 60;
data.s = data.s % 60;
if(data.m/60>=1){
data.h += data.m / 60;
data.m = data.m % 60;
}
}
printf("\n新时间是%d小时%d分%d秒",data.h,data.m,data.s);
return 0;
}