第1个回答 推荐于2016-08-04
#include <stdio.h>
struct student
{ char name[10];
int score;
};
struct student st[10];
void process()
{int i,j;
struct student tmp;
for(i=0;i<9;i++)
for(j=0;j<9-i;j++)
if(st[j].score<st[j+1].score)
{tmp=st[j];st[j]=st[j+1];st[j+1]=tmp;}
}
int main()
{char No[10][3]={"一","二","三","四","五","六","七","八","九","十"};
int i;
for(i=0;i<10;i++)
{
gets(st[i].name);
scanf("%d",&st[i].score);
fflush(stdin);
}
process();
for(i=0;i<10;i++)
printf("第%s名 %s %d\n",No[i],st[i].name,st[i].score);
return 0;
}
本回答被提问者采纳