这样写可以吗,为什么不显示结果
#include <stdio.h>
#define N 10
int totalscore(int score[])
{
int i,sum;
sum=0;
for(i=0;i<10;i++)
{
sum+=score[i];
}
return sum;
}
int maxscore(int score[])
{
int i,maxscore;
maxscore=0;
for(i=0;i<9;i++)
{
if(score[i]>score[i+1])
{
maxscore=score[i];
}
}
return maxscore;
}
int averagescore(int score[])
{
int averagescore;
averagescore=0;
averagescore= totalscore(score)/10;
return averagescore;
}
int sortscore(int score[])
{
int i,j,temp;
for(i=0;i<10;i++)
{
for(j=0;j<=i;j--)
{
if(score[j]<score[j+1])
{
temp=score[j+1];
score[j+1]=score[j];
score[j]=temp;
}
}
}
for(i=0;i<10;i++)
{
if(i!=9)
{
printf("%d, \n",score[i]);
}
else
{
printf("%d\n",score[i]);
}
}
return score[i];
}
int main()
{
int score[N]={67,98,75,63,82,79,81,91,66,84};
printf("考试成绩总分为:%d\n",totalscore(score));
printf("考试最高分为:%d\n",maxscore(score));
printf("考试平均分为:%d\n",averagescore(score));
printf("考试成绩降序排序之后:%d\n",sortscore(score));
return 0;
}
这样写有问题吗,为什么不显示啊