综合练习题
#define N 10
int main()
{
int score[N]={67,98,75,63,82,79,81,91,66,84};
printf("总分为:%d\n",getSum(score));
printf("成绩降序排列\n");
getJiangxu(score);
int i;
for(i=0;i<N;i++)
{
printf("%d,",score[i]);
}
getMax(score);
getMin(score);
pritnf("平均分为:%d",getAverage(score));
return 0;
}
int getSum(int score[])
{
int sum=0,i;
for(i=0;i<N;i++)
{
sum +=score[i];
}
return sum;
}
int getAverage(int score[])
{
return getSum(socre)/N;
}
int getJiangxu(int score[])
{
int i,j;
for(i=9;i>=0;i--)
{
for(j=0;j<i;j++)
{
if(score[j]<score[j+1])
{
int temp;
temp=score[j];
score[j]=score[j+1];
score[j+1]=temp;
}
}
}
return 0;
}
int getMax(int score[])
{
getJiangxu(score);
printf("最高分为:%d\n",score[0]);
return 0;
}
int getMin(int score[])
{
getJiangxu(score);
printf("最低分为:%d\n",score[9]);
return 0;
}
可有高手知道此题错在哪里?