回复 楼主 smilekurt
#include<stdio.h>
int main (void)
{
int p,q,sum,score,s;
int i,index,k,n,temp,j;
int a[10];
sum=0;
printf("参加比赛的人数:");
scanf("%d",&n);
for(p=0;p<n;p++){
sum=0;
for (q=1;q<=3;q++){
printf ("%d号评为给的分是:",q);
scanf ("%d",&score);
sum=sum+score;
}
score=sum/3;
//scanf("score=%d",&a[p]);
a[p]=score;
}
for (k=0;k<n;k++){
index=k;
for (i=k+1;i<n;i++)
if (a[i]<a[index])
index=i;
temp=a[index];
a[index]=a[k];
a[k]=temp;
}
printf("排完之后:\n");
for (j=0;j<n;j++)
printf("%d\n",a[j]);
return 0;
}