#include
typedef struct
{
char name[21];
int score[5];
double avg;
}per;
void sort(per x[],int n)
{
int i,j;
per t;
for(i=0;i
for(j=i+1;j
if(x[i].avg
t=x[i],x[i]=x[j],x[j]=t;
}
void average(per x[],int n)
{
int i,min,j,m;
for(i=0;i
{
min=x[i].score[0];
for(j=1;j<5;j++)
if(min
x[i].avg=m=0;
for(j=0;j<5;j++)
if(x[i].score[j]!=min)x[i].avg+=x[i].score[j],m++;
x[i].avg/=m;
}
}
void main()
{
per x[10]={
{"a1",96,98,91,89,88},
{"a2",90,96,95,96,91},
{"a3",96,98,91,89,84},
{"a4",90,96,95,96,92},
{"a5",96,98,91,89,80},
{"a6",90,96,95,96,96},
{"a7",96,98,91,89,86},
{"a8",90,96,95,96,93},
{"a9",96,98,91,89,83},
{"a10",90,96,95,96,99}
};
int i;
average(x,10);
sort(x,10);
printf("一等奖:\n%s %.2lf\n",x[0].name,x[0].avg);
printf("二等奖:\n");
for(i=1;i<3;i++)
printf("%s %.2lf\n",x[i].name,x[i].avg);
printf("三等奖:\n");
for(i=3;i<10;i++)
printf("%s %.2lf\n",x[i].name,x[i].avg);
}