#include<stdio.h>
int a()
{
int score[10]={67,78,56,22,58,54,55,69,87,99};
int i,sum;
for(i=0;i<10;i++)
sum+=score[i];
printf("总分为%d\n",sum);
return 0;
}
int b()
{
int score[10]={67,78,56,22,58,54,55,69,87,99};
int max,i;
max=score[0];
for(i=1;i<10;i++)
if(max>score[i])
max=score[i];
printf("最大值为%d\n",max);
}
int c()
{
int score[10]={67,78,56,22,58,54,55,69,87,99};
int min,i;
min=score[0];
for(i=1;i<10;i++)
if(min>score[i])
min=score[i];
printf("最小值为%d\n",min);
}
int d()
{
int score[10]={67,78,56,22,58,54,55,69,87,99};
int avarage,i,sum;
for(i=0;i<10;i++)
sum+=score[i];
avarage=sum*1.0/10;
printf("平均分为%d\n",avarage);
}
int f()
{
int score[10]={67,78,56,22,58,54,55,69,87,99};
int i,j;
for(i=0;i<10;i++)
if(score[i]<score[i+1])
{
j=score[i+1];
score[i+1]=score[i];
score[i]=j;
}
for(i=0;i<10;i++)
printf("%d\n",score[i]);
}
int main()
{
int a();
int b();
int c();
int d();
int f();
}
自定义函数有问题,最后主函数里的自定义函数调用也没有写清楚参数
别学了