#include struct stu { int num; float grade1; float grade2; float grade3; float grade; float ag; }s[10],ss; int main() { printf(" 1.Input\n"); printf(" 2.Output\n"); printf(" 3.Order\n"); printf(" 4.Quit\n"); char a; scanf("%c",&a); if(a=='i') { printf("Please input info of the three students:\n"); for(int i=0;i<3;i++) { scanf("%d%f%f%f",&s[i].num,&s[i].grade1,&s[i].grade2,&s[i].grade3); } for(int i=0;i<3;i++) { s[i].grade=s[i].grade1+s[i].grade2+s[i].grade3; s[i].ag=s[i].grade/3; } for(int i=0;i<2;i++) { ss=s[i]; for(int j=i+1;j<3;j++) { if(s[i].grade>s[j].grade) { ss=s[i]; s[i]=s[j]; s[j]=ss; } } } for(int i=0;i<3;i++) { printf("%d,%.1f,%.1f\n",s[i].num,s[i].grade,s[i].ag); } } else if(a=='o') printf("You are trying to Output info"); else if(a=='m') printf("You are trying to Make things ordered"); else if(a=='q') printf("You are about to Quit"); else printf("Wrong input"); return 0; }