资源描述:
《c语言成绩管理初级》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、c语言成绩管理初级voidListMenu(){printf("成绩管理菜单");printf("=================");printf("1.输入成绩");printf("2.统计处理");printf("3.名次排序");printf("4.输出");printf("9.随机测试数据");printf("0.退出");printf("=================");}//endListMenu()voidoutputmenu(){printf("输出二级菜单
2、");printf("=================");printf("1.按学号输出成绩");printf("2.按名次输出成绩");printf("3.按名次输出Topn");printf("4.输出不及格名单");printf("0.返回主菜单");printf("=================");}//endoutputmenu()voidinputmenu(){printf("输入二级菜单");printf("=================");printf("
3、1.C语言");printf("2.数学");printf("3.英语");printf("0.返回主菜单");printf("=================");}//endinputmenu()intcoursemenu(){charcourseID;printf("输出的科目");printf("=================");printf("1.C语言");printf("2.数学");printf("3.英语");printf("================
4、=");do{printf("请选择输出的科目:");courseID=getche();if(courseID<'1'
5、
6、courseID>'4')printf("输入错误!课程号0-3");}while(courseID<'1'
7、
8、courseID>'4');return(courseID-48);}//endinputmenu()voidinputbyCrsId(intCrsId){inti;printf("请依次输入第%d科的成绩:",CrsId);for(i=1;i<=N;i++){do{printf
9、("请输入第%d个同学的成绩:",i);scanf("%d",&score[i][CrsId]);if(score[i][CrsId]>100
10、
11、score[i][CrsId]<0)printf("成绩错误!");}while(score[i][CrsId]>100
12、
13、score[i][CrsId]<0);}}//endinputbyCrsId()voidoutputbyno(){inti;printf("按学号输出");printf("学号t姓名tC语言t数学t英语t总分t名次");p
14、rintf("==================================================");for(i=1;i<=N;i++){printf("%dt%st%dt",i,name[i],score[i][1]);printf("%dt%dt",score[i][2],score[i][3]);printf("%dt%d",score[i][0],rank[i][0]);printf("");}printf("==================================
15、===============");printf("t总分:t");printf("%dt%dt%dt",score[0][1],score[0][2],score[0][3]);printf("t平均:t");printf("%.2ft%.2ft%.2f",1.0*score[0][1]/N,1.0*score[0][2]/N,1.0*score[0][3]/N);}//endoutputbyno()//统计各科、各个同学的总分voidprocess(){inti,j;for(i=1;i<=
16、N;i++)score[i][0]=0;//各个同学的总分清0for(j=1;j<=CrsNum;j++)score[0][j]=0;//各科总分清0for(i=1;i<=N;i++)for(j=1;j<=CrsNum;j++){score[i][0]+=score[i][j];score[0][j]+