#include
using namespace std;
int main()
{
int a[10],sum=0;
double ave;
cout<<"输入十个整数"<
{
cin>>a[i];
sum=sum+a[i];
}
ave=sum/10.0;
for(int j=0;j<10;j++)
{
if(a[j]>ave)
{
cout< }
}
return 0;
}
以前给别人拿C写过,直接改了没运行,你自己运行看看
#include
using namespace std;
void main()
{
int num[10];
int count = 0;
double sum = 0;
cout << "input ten numbers : " << endl;
while(true)
{
cin >> num[count];
sum += num[count];
count++;
if (count == 10)
break;
}
double avg = sum/10;
cout << "avg : " << avg << endl;
cout << "less than avg numbers:" << endl;
for (int i=0;i<10;i++)
{
if (avg > num[i])
cout << num[i] << endl;
}
system("pause");
}