二、基本操作題(共18分)
給定程序的功能是計算score中m個人的平均成績aver,將低于aver的成績放在be-low中,通過函數(shù)名返回人數(shù)。
例如,當(dāng)score={10,20,30,40,50,60,70,80,90},m=9時,函數(shù)返回的人數(shù)應(yīng)該是4,below={10,20,30,40}。
注意:部分源程序給出如下。
請勿改動main()函數(shù)和其他函數(shù)中的任何內(nèi)容,僅在橫線上填人所編寫的若干表達(dá)式或語句。
試題程序:
#include
#include
int fun(int score[],int m,int below[])
{
int i,j=0;
float aver=0.0;
for(i=0;i aver+=score[i];
aver/=(float)m;
for(i=0;i if(score[i] below[j++]=【1】 ;
return j;
}
} void main()
{
int i,n,below[9];
int score[9]={10,20,30,40,50,60,70,80,90};
n=fun(score,9, 【2】 );
printf("\n Below the average score are:%d\n",n);
for(i=0;i printf("%d",【3】);
}
編輯推薦:
2014年上半年計算機(jī)等級考試報名時間及入口專題
各地2014年計算機(jī)等級考試費(fèi)用匯總
2014年計算機(jī)等級考試時間