问题 填空题

给定程序的功能是计算score中m个人的平均成绩aver,将低于aver的成绩放在below中,通过函数名返回人数。
例如,当score=(10,20,30,40,50,60,70,80,90),m=9时,函数返回的人数应该是4,below=10,20,30,40)。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<string.h>
int fun(int score[],int m,int below[])

int i,j=0;
float aver=0.0:
for(i=0;i<m;i++)
aver+=score[i]:
aver/=(float)m;
n=fun(score,9, (2) );
printf("\n Below the average score are:%d\n",n);
for(i=0;i<n;i++)
for(i=0;i<m;i++)
if(score[i]~aver)
below[j++]= (1)
return j;

void main()

int i,n,below[9];
int score[9]=10,20,30,40,50,60,70,80,90);
printf("%d", (3) );

答案

参考答案:belqw[i]或*(below+i)

解析: fun函数的功能是返回低于平均成绩的人数,通过for循环遍历数组score,求和存入变量aver,然后计算出平均值。第二个循环将低于平均成绩的数据赋值数组b,因此第1处填score[i]或*(score+i);在主函数中调用函数fun时,最后一个参数应填入数组名below,即将低分考生数据存入数组below中,然后语句printf("\n Below the average score are:%d"n);输出低分考生个数,n值即fun函数返回值也就是低分考生的人数值。最后利用循环输出below中的结果。

解答题
单项选择题