![](https://csdnimg.cn/release/download_crawler_static/86209279/bg4.jpg)
printf(”│ 1:按语文成绩降序排序 │\n”);
printf(”├───────────────────────┤\n”);
printf(”│ 2:按数学成绩降序排序 │\n");
printf("├───────────────────────┤\n”);
printf("│ 3:按英语成绩降序排序 │\n");
printf("├───────────────────────┤\n”);
printf("│ 4:安总成绩降序排序 │\n”);
printf(”└───────────────────────┘\n");
printf("请输入选择:\n”);
scanf("%d”,&a);
Sleep(300);
system("cls");
qsort(stu,n,sizeof(stu[0]),cmp[a]);
output(stu,n,0);
}
int xuehao(const void *a,const void *b)
{
if ( strcmp ((( struct student *)a)->num , ( ( struct student * )
b)->num)>0)
return —1;
else
return 1;
}
int yuwen(const void *a,const void *b)
{
return ((struct student *)a)—>yuwen < ((struct student *)b)
->yuwen ? 1 : —1;
}
int shuxue(const void *a,const void *b)
{
return (( struct student * ) a)—〉 shuxue 〈 ((struct student
*)b)—>shuxue ? 1 : —1;
}
int yingyu(const void *a,const void *b)
{
return ((struct student *)a)-〉yingyu < ((struct student *)b)—〉
yingyu ? 1 : -1;
}
int zongchengji(const void *a,const void *b)
{
return ((struct student *)a)—>zong 〈 ((struct student *)b)
->zong ? 1 : —1;
}
void shanchuyi(struct student stu[],int *num1)