#include #include struct student { char id[20]; char name[20]; char clas[20]; double Math; double Physic; double English; double sum; }s[20]; int T=0; void menu() { printf("1.input\n"); printf("2.delete\n"); printf("3.select\n"); printf("4.order\n"); printf("5.output\n"); printf("6.quit\n"); printf("please input your option\n"); } void inputstudent(struct student *t) { printf("Id "); scanf("%s",&(t->id)); printf("class "); scanf("%s",&(t->clas)); printf("name "); scanf("%s",&(t->name)); printf("score1 "); scanf("%lf",&(t->Math)); printf("score2 "); scanf("%lf",&(t->Physic)); printf("score3 "); scanf("%lf",&(t->English)); t->sum=t->Math+t->Physic+t->English; T++; } void outputstudent(struct student *t) { printf("%s,%s,%s,%.1f,%.1f,%.1f,%.1f\n",t->id,t->clas,t->name,t->Math,t->Physic,t->English,t->sum); } void deletestudent(struct student *t) { char de[10]; scanf("%s",de); int i=0; while(iid,de)==0||strcmp((t+i)->name,de)==0) { for(int j=i;jid,f)==0||strcmp((t+i)->clas,f)==0) { outputstudent((t+i)); p=1; } if(i==T-1&&p==0) printf("there is no eligible student\n"); } } void orderstudent(struct student *t) { for(int i=0;iclas)>strlen((t+j)->clas)) { struct student o; o=*(t+i); *(t+i)=*(t+j); *(t+j)=o; } } } for(int i=0;iclas)==strlen((t+j)->clas)&&strcmp((t+i)->clas,(t+j)->clas)>0) { struct student o; o=*(t+i); *(t+i)=*(t+j); *(t+j)=o; } } } for(int i=0;iclas,(t+j)->clas)==0&&(t+i)->sum<(t+j)->sum) { struct student o; o=*(t+i); *(t+i)=*(t+j); *(t+j)=o; } } } } int main() { menu(); int OS; flag1: scanf("%d",&OS); if(OS==1) { flag2: inputstudent(&s[T]); printf("continue?\n"); char p[10]; scanf("%s",p); if(p[0]=='y') { goto flag2; } else { menu(); goto flag1; } } if(OS==2) { flag3: deletestudent(&s[0]); printf("continue?\n"); char p2[10]; scanf("%s",p2); if(p2[0]=='y') { goto flag3; } else { menu(); goto flag1; } } if(OS==3) { flag4: findstudent(&s[0]); printf("continue?\n"); char p3[10]; scanf("%s",p3); if(p3[0]=='y') { goto flag4; } else { menu(); goto flag1; } } if(OS==4) { orderstudent(&s[0]); printf("\n"); for(int i=0;i