问题遇到的现象和发生背景
用代码块功能插入代码,请勿粘贴截图
运行结果及报错内容
输入到要加的小时时就报错
我想要达到的结果
想做一个计算时间的计算器
```c
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int xs, cs, cf, xf, js, jf, t;
t = 0; xs = 0; cs = 0; cf = 0; xf = 0; js = 0; jf = 0;
printf("现在的小时\n");
scanf("%d", &xs);
printf("请输入现在的分钟\n");
scanf("%d", &xf);
printf("请输入要加的小时\n");
scanf("%d", js);
printf("请输入要加的分钟\n");
scanf("%d", &jf);
cs = xs + js;
cf = xf + xs;
while (cs < 24 && cf < 60)
{
if (cs > 24)
{
t += 1;
cs = cs - 24;
}
if (cf > 60)
{
cs += 1;
cf -= 60;
}
}
printf("第%d天%d点%d分", t, cs, cf);
return 0;
}
```