fengfenglong @ 2022-09-02 11:44:20
#include <iomanip>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string>
using namespace std;
//#define PI 3.1415926
int main()
{
int a[10];
int b,i=0,sum=0;
while(cin>>a[i])
{
i++;
}
cin>>b;
cout<<b;
for(int j=0;j<10;j++)
{
if(((30+b)>=a[j]))
{
sum+=1;
cout<<sum;
}
}
cout<<sum;
return 0;
}
b值代表了陶陶的身高,我输出b显示为0
by sandwich03 @ 2022-09-17 14:29:28
#include<iostream>
using namespace std;
int main()
{
int a[10];
for(int i=0;i<10;i++)cin>>a[i];
int sg,sum=0;cin>>sg;
sg+=30;
for(int i=0;i<10;i++)
if(sg>=a[i])sum++;
cout<<sum;
return 0;
}
by qushiwen @ 2022-10-02 18:53:05
把while(cin>>a[i])改成
for(int i=0;i < 10;i++)
{
cin>>a[i]
}
不就行了