m个人的成绩存放在score数组中,请编写函数fun(),它的功能是将高于平均分的人
问题:
m个人的成绩存放在score数组中,请编写函数fun(),它的功能是将高于平均分的人数作为函数值返回,将高于平均分的分数放在叩所指的数组中。
例如,当score数组中的数据为24,35,88,76,90,54, 59,66,96时,函数返回的人数应该是5,up中的数据应为88, 76, 90, 66, 96。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <conio.h>
#include <stdio.h>
#include <string.h>
int fun(int score[],int m,int up[])
main()
int i,n,up[9];
int score[9]=24,35,88,76,90,54,
59,66,96;
clrscr();
n=fun(score,9,up);
printf("\nup to the average score are:");
for(i=0;i<n;i++)
printf("%d",up[i]);