nanyinlang @ 2018-07-17 10:43:04
using namespace std;
int main()
{ int a[10] = {0}; int b = 0; int e = 0; int i = 0; int d = 0; for(;i<=9;++i) { cin >> a[i]; } cin >> b; d = b +30; while(i>0) {if(d>= a[i]) {++e;} --i; } cout << e;
return 0;
}
by 梧桐灯 @ 2018-07-17 10:53:28
读入完后i要赋值为9 而且,应该while (i >= 0)
by nanyinlang @ 2018-07-17 14:18:27
感谢感谢
by nanyinlang @ 2018-07-17 14:18:41
@犇羴鱻赑骉 感谢大神
by SteveFang @ 2019-07-19 12:57:24
#include <iostream>
using namespace std;
int main()
{ int a[10] = {0}; int b = 0; int e = 0; int i = 0; int d = 0; for(;i<=9;++i) { cin >> a[i]; } cin >> b; d = b +30; while(i>0) {if(d>= a[i]) {++e;} --i; } cout << e;
return 0;
}
by SteveFang @ 2019-07-19 12:57:36
你的代码
by SteveFang @ 2019-07-19 12:57:48
为啥要压行