#include #include #define N 7 struct stu_info { int num,cls,flag; char name[10]; float maths,physics,english; }; struct stu_info stu[N]={{10001,11,0,"Zhang",99.5,88.5,89.5}, {10002,12,0,"Yang",77.9,56.5,87.5}, {10003,11,0,"Liang",92.5,99.0,60.5}, {10004,11,0,"Cai",89.6,56.9,90.5}, {10005,14,0,"Fu",55.6,67.9,98.9}, {10006,12,0,"Mao",22.1,45.9,99.2}, {10007,13,0,"Zhan",35.6,67.9,88.0}}; void sort(struct stu_info *stu,int n) { int i,j; struct stu_info tmp; for(i=0;icls>(stu+j+1)->cls)||((stu+j)->cls==(stu+j+1)->cls)&&((stu+j)->num>(stu+j+1)->num)) { tmp = *(stu+j); *(stu+j) = *(stu+j+1); *(stu+j+1) = tmp; } } } return; } void fcls() { int start,end,i; scanf("%d-%d",&start,&end); for(i=0;i=start) printf("%d %d %s %.1f %.1f %.1f\n",stu[i].num,stu[i].cls,stu[i].name,stu[i].maths,stu[i].physics,stu[i].english); } } void fnum() { int start,end,i; scanf("%d-%d",&start,&end); for(i=0;i=start) printf("%d %d %s %.1f %.1f %.1f\n",stu[i].num,stu[i].cls,stu[i].name,stu[i].maths,stu[i].physics,stu[i].english); } } void fname() { char q[10];int i,j,flag=1; scanf("%s",q); for(i=0;i=e) printf("%d %d %s %.1f %.1f %.1f\n",stu[i].num,stu[i].cls,stu[i].name,stu[i].maths,stu[i].physics,stu[i].english); } } int main() { sort(stu,N); int i,type; scanf("%d",&type); switch(type) { case 1:fcls();break; case 2:fnum();break; case 3:fname();break; case 4:fsum();break; } }