访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容
#include <stdio.h>#include <stdlib.h>int main (){ int scores[11]={0,76,85,90,67,59,79,82,95,91,65,}; int num; int grade; int i,choice; int doit=1; int maxValue=0; while (doit) { printf("----选单----\n"); printf("1:查询成绩\n"); printf("2:修改成绩\n"); printf("3:显示成绩\n"); printf("4:显示最高分\n"); printf("5:离开作业\n"); printf("请输入选项(1到4).===>"); scanf("%d", &choice); if(choice<3) { printf("请输入学生学号(1到10).==>"); scanf("%d",&num); } switch(choice) { case 1: grade = scores[num]; printf("学生程绩:%d\n",grade); break; case 2: grade = scores[num]; printf("原来学生成绩:%d\n",grade); printf("输入新成绩. ==>"); scanf("%d",grade); scores[num]=grade; break; case 3: printf("学生成绩:\n"); for (i=1;i<=10;i++) printf("%d:%d\n",i,scores); printf("\n"); break; case 4: for(i=1;i<=10;i++) { if(maxValue<scores[ i ]) { maxValue=scores[ i ]; num=i; } } printf("成绩最高的是:%d号\n",num); case 5: doit = 0; break; } } system("PAUSE"); return 0;}