#include int main() { void manu(); void log(); manu(); log(); return 0; } void manu() { printf(" 1.Input\n"); printf(" 2.Output\n"); printf(" 3.Order\n"); printf(" 4.Quit\n"); char t=getchar(); if(t=='i') { printf("Please input info of the three students:\n"); } else if(t=='o') { printf("You are trying to Output info\n"); } else if(t=='m') { printf("You are trying to Make things ordered\n"); } else if(t=='q') { printf("You are about to Quit\n"); } else { printf("Wrong input\n"); } } void log() { float sum(float a[][5]); void sort(float a[][5]); float student[3][5]; int i,j; for(i=0;i<3;i++) { for(j=0;j<4;j++) { scanf("%f",&student[i][j]); } } sum(student); sort(student); for(i=0;i<3;i++) { printf("%g,%4.1f,%4.1f\n",student[i][0],student[i][4],student[i][4]/3); } } float sum(float a[][5]) { int i; for(i=0;i<3;i++) { a[i][4]=a[i][1]+a[i][2]+a[i][3]; } } void sort(float a[][5]) { void swap(float a[][5],int x,int y); int i,j,k; for(i=0;i<3;i++) { k=i; for(j=i;j<3;j++) { if(a[i][4]>a[j][4]) { k=j; } } swap(a,i,k); } } void swap(float a[][5],int x,int y) { int i; float temp; for(i=0;i<5;i++) { temp=a[x][i]; a[x][i]=a[y][i]; a[y][i]=temp; } }