Mirror丶无风 @ 2017-07-17 22:26:44
#include<iostream>
using namespace std;
int main()
{
int a[10],b,c=0,i;
for(i=0;i<=9;i++)
cin>>a[i];
cin>>b;
b+=30;
for(i=0;i<=9;i++)
{
if(a[i]<b)
c++;
}
cout<<c+1;
return 0;
}
by Keyong @ 2017-07-18 07:01:46
第12行应该是 if(a[i]<=b)
by cwtcwt @ 2017-07-19 11:43:57
是
by 玲静 @ 2017-07-19 19:19:03
#include<iostream>
using namespace std;
int main()
{
int a[10],b,c=0,i;
for(i=0;i<=9;i++)
cin>>a[i];
cin>>b;
b+=30;
for(i=0;i<=9;i++)
{
if(a[i]<=b)
c++;
}
cout<<c;
return 0;
}
by 大主宰 @ 2017-07-19 21:23:21
#include<iostream>
using namespace std;
int main()
{
int a[10],b,c=0,i;
for(i=0;i<=9;i++)
cin>>a[i];
cin>>b;
b+=30;
for(i=0;i<=9;i++)
{
if(a[i]<=b)
c++;
}
cout<<c;
return 0;
}
by WH1KI9RAVE @ 2017-07-22 10:50:39
这是不是等于发答案
by Mirror丶无风 @ 2017-07-26 07:54:47
@Yhy9630 谢谢
by Mirror丶无风 @ 2017-07-26 07:55:09
@大主宰 谢谢
by Mirror丶无风 @ 2017-07-26 07:55:26
@玲静 谢谢
by Terrie @ 2017-07-30 16:05:34
#include<iomanip>
#include<iostream>
#include<ctime>
#include<cmath>
#include<cstring>
using namespace std;
int b;
int a[10];
double dist;
int trsf=1;
int main()
{
while(trsf<=10){
cin>>a[trsf];
++trsf;
}
trsf=1;
cin>>b;
b=b+30;
while(trsf<=10){
if(a[trsf]<=b)
dist++;
++trsf;
}
cout<<dist;
return 0;
}
能看一下怎么错了吗?谢谢
by ezoiHQM @ 2017-08-03 07:33:48
@ Terry2005 int a[10]是定义了十个变量a[0]到a[9],应该把int a[10]改为int a[11],或者while循环时把0赋值给trsf,把trsf<=10改为trsf<10即可。