好像自定义函数是有问题,求解?
#include <stdio.h>
#define N 10
int score[N]={67,98,75,63,82,79,81,91,66,84};
int one( score[])
{
int i, sum1;
for(i=0;i<10;i++)
{
sum1+=score[i];
printf("考试总分是%d\n",sum1);
}
return sum1;
}
int two( score[])
{
int max,i;
max=0;
for(i=0;i<10;i++)
{
if(max>score[i])
{
max=score[i];
}
}
printf("最高分是%d\n",max);
return max;
}
int three( score[])
{
int min,i;
min=0;
for(i=0;i<10;i++)
{
if(min<score[i])
{
min=score[i];
}
}
printf("最低分是%d\n",min);
return min;
}
int four( score[])
{
int i,sum2;
double per;
for(i=0;i<10;i++)
{
sum2+=score[i];
}
per=sum2/10;
printf("考试平均分是%f\n",per);
return per;
}
int five( score[])
{
int i,j,sum,n;
for(i=0,i<10,i++)
{
for(j=0,j<10,j++)
{
if(score[i]>score[j])
{
sum3=score[i];
score[i]=score[j];
score[j]=sum3;
}
}
}
for(n=0;n<10;n++)
{
printf("%d,",score[n]);
}
return score[n];
}
int main()
{
one(score[N]);
twe(score[N]);
three(score[N]);
four(score[N]);
five(score[N]);
return 0;
}