求大佬看看我错在哪

P1425 小鱼的游泳时间

@[Zehao](/space/show?uid=47312) 最好这样做: ```cpp 时间差: int min,min1,min2; min1 = a*60+b; min2 = c*60+d; min = min2-min1; ```
by zxz_sword @ 2019-05-26 18:27:33


@[Zehao](/space/show?uid=47312) ```cpp 区分小时和分钟 int hour; hour = minute/60; minute = minute%60; ```
by zxz_sword @ 2019-05-26 18:28:19


@[Zehao](/space/show?uid=47312) 顺便求关注
by zxz_sword @ 2019-05-26 18:28:30


@[zxz_sword](/space/show?uid=213272) 好的哥 不过我想知道我那一堆代码的问题在哪???
by Zehao @ 2019-05-26 18:34:09


@[Zehao](/space/show?uid=47312) ``` cout<<"Enter the time:\n"; ``` ????
by hfee @ 2019-05-26 18:38:05


@[白狼与玫瑰](/space/show?uid=123936) 哈哈哈我闲的没事加这一行干什么,多谢大佬指点,原来删去那一行就好了。。。
by Zehao @ 2019-05-26 18:41:11


把第一个输出去掉就行了。
by gcl2004 @ 2019-05-26 19:35:08


看看我这个c语言应该是没问题的吧 # include <stdio.h> int main(void) { int a, b, c, d, sum, val; printf("请输入小鱼的开始时间:"); scanf("%d %d", &a, &b); printf("请输入结束时间:"); scanf("%d %d", &c, &d); if (a < 24 && c<24 && a < c) { if (b<60 && d<60 && d == b) { printf("游了%d小时\n", c-a); } else if(b < d) { printf("游了%d小时, %d 分钟", c-a, d-b); } else if (b > d ) { val = c-a-1; sum = (60-(b-d)); printf("游了%d个小时, %d分钟\n", val, sum); } } else printf("小鱼冤死!"); return 0; }
by yzcaaa @ 2019-06-10 16:35:24


#include<iostream> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c>>d; int e=a*60+b; int f=c*60+d; int g=f-e; cout<<g/60<<" "<<g%60<<endl; return 0; }
by 养生莫熬夜 @ 2019-08-14 09:36:26


这样做可得AC哦
by 养生莫熬夜 @ 2019-08-14 09:37:03


|