You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pbs89iory 137aa87c46
ADD file via upload
1 year ago
8.c ADD file via upload 1 year ago
README.md Update README.md 1 year ago

README.md

步骤1 #include <stdio.h> int main( ) { int num_spaces =30; printf("%*s1.Input\n",num_spaces," "); printf("%*s2.Output\n",num_spaces," "); printf("%*s3.Order\n",num_spaces," "); printf("%*s4.Quit\n",num_spaces," "); char a; again:a=getchar(); switch(a) { case'i':printf("You are trying to Input info");break; case'o':printf("You are trying to Output info");break; case'm':printf("You are trying to Make things orderd");break; case'q':printf("You are about to Quit");break; case'\n':printf("\n");break; default:printf("Wrong input"); } goto again; }

步骤2 #include <stdio.h> int main( ) { struct Student { int xh; float gs; float dw; float yy; float zcj; } student1,student2,student3; scanf("%d%f%f%f",&student1.xh,&student1.gs,&student1.dw,&student1.yy); scanf("%d%f%f%f",&student2.xh,&student2.gs,&student2.dw,&student2.yy); scanf("%d%f%f%f",&student3.xh,&student3.gs,&student3.dw,&student3.yy); student1.zcj=student1.gs+student1.dw+student1.yy; student2.zcj=student2.gs+student2.dw+student2.yy; student3.zcj=student3.gs+student3.dw+student3.yy; printf("学号 %d 高数成绩 %.1f 大学物理成绩 %.1f 英语成绩 %.1f 总成绩 %.1f\n",student1.xh,student1.gs,student1.dw,student1.yy,student1.zcj); printf("学号 %d 高数成绩 %.1f 大学物理成绩 %.1f 英语成绩 %.1f 总成绩 %.1f\n",student2.xh,student2.gs,student2.dw,student2.yy,student2.zcj); printf("学号 %d 高数成绩 %.1f 大学物理成绩 %.1f 英语成绩 %.1f 总成绩 %.1f\n",student3.xh,student3.gs,student3.dw,student3.yy,student3.zcj); }

步骤3 #include <stdio.h> int main( ) { int num_spaces =30; printf("%*s1.Input\n",num_spaces," "); printf("%*s2.Output\n",num_spaces," "); printf("%*s3.Order\n",num_spaces," "); printf("%*s4.Quit\n",num_spaces," "); char a; again:a=getchar(); switch(a) { case'i':printf("Please input info of the three students:"); struct Student { int xh; float gs; float dw; float yy; float zcj; float pjf; } student1,student2,student3,studenttemp; scanf("%d%f%f%f",&student1.xh,&student1.gs,&student1.dw,&student1.yy); scanf("%d%f%f%f",&student2.xh,&student2.gs,&student2.dw,&student2.yy); scanf("%d%f%f%f",&student3.xh,&student3.gs,&student3.dw,&student3.yy); student1.zcj=student1.gs+student1.dw+student1.yy; student2.zcj=student2.gs+student2.dw+student2.yy; student3.zcj=student3.gs+student3.dw+student3.yy; student1.pjf=student1.zcj/3; student2.pjf=student2.zcj/3; student3.pjf=student3.zcj/3; if(student2.zcj>student3.zcj) { studenttemp = student2; student2 = student3; student3 = studenttemp; } if(student1.zcj>student3.zcj) { studenttemp = student1; student1 = student3; student3 = studenttemp; } if(student1.zcj>student2.zcj) { studenttemp = student1; student1 = student2; student2 = studenttemp; } printf("%d,%.1f,%.1f\n%d,%.1f,%.1f\n%d,%.1f,%.1f\n",student1.xh,student1.zcj,student1.pjf,student2.xh,student2.zcj,student2.pjf,student3.xh,student3.zcj,student3.pjf); break; case'o':printf("You are trying to Output info");break; case'm':printf("You are trying to Make things orderd");break; case'q':printf("You are about to Quit");break; case'\n':printf("\n");break; default:printf("Wrong input"); } goto again; }