资源描述:
《c语言课程设计 200行代码 -学生成绩查询系统》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、功能:查询修改统计成绩。#includestructstudent/*成绩表的结构声明*/{intnum;charname[15];charsex;floatWuLi;floatShuXue;floatYingYu;floatKuaiJi;floattotle;};/*定义6个学生的信息:*/#defineSTU_NUMBER6/*宏定义学生数为6*/structstudentStu[STU_NUMBER]={{101,"yuchen",'F',98,85,96,89,0},{102,"xiaotong",'F',99,91,90
2、,93,0},{103,"likanglong",'M',76,83,74,82,0},{104,"yinger",'F',88,76,89,77,0},{105,"fengjiao",'F',97,100,94,96,0},{106,"sunyao",'M',87,89,66,84,0}};intSelectMainMenu();/*显示并选择主菜单。返回:被选择的菜单项*//*所有的函数声明:*/voidShow();/*成绩查询模块*/voidModify();/*成绩修改模块*/voidStat();/*成绩统计模块*/voidStatAv
3、e(float*AveWuLi,float*AveShuXue,float*AveYingYu,float*AveKuaiJi);/*统计平均分*/intFindStudent(intnum);/*根据学号查找某一学生*/voidSetAllTotle();/*计算所有学生总分*/voidSetTotle(intNo);/*计算第No个学生总分*/voidShowAllStudent();/*显示所有成绩*/voidShowTitle();/*显示表头信息*/voidShowStudent(intNo);/*显示第No个的学生信息*/voidmai
4、n(){intisend=0,password=0;/*程序结束标志量,0表示不结束,1表示结束*/SetAllTotle();/*计算所有学生总分*/while(password!=666){printf("qingshurumima:");scanf("%d",&password);}while(1){switch(SelectMainMenu())/*显示并选择主菜单*/{case1:/*成绩查询*/Show();/*调用成绩查询函数*/break;case2:/*成绩修改*/Modify();/*调用成绩修改函数*/break;case
5、3:/*成绩统计*/Stat();/*调用成绩统计函数*/break;case4:/*退出系统*/printf("xiexienindeshiyong,zaijian!");isend=1;/*设置程序结束标志*/break;}if(isend)break;/*程序结束*/}}intSelectMainMenu()/*显示并选择主菜单。返回:被选择的菜单项*/{intmenu_no=0;do/*显示并选择菜单*/{printf("=================================");printf("6、guanlichengxu>");printf("zuozhe:liyiman");printf("=================================");printf("zhucaidan:");printf("1-chengjichaxun");printf("2-chengjixiugai");printf("3-chengjitongji");printf("4-tuichuxitong");printf("qingxuanze(1-4):");scanf("%d",&menu_no);}wh
7、ile(menu_no<1&&menu_no>4);/*直到选择出正确的序号*/returnmenu_no;}voidShow()/*成绩查询模块*/{intn,i;while(1){printf("====chengjichaxun====");printf("qingshuruxuehao(shuru0tuichuchengjichaxun,shuru1chaxunquanbu):");scanf("%d",&n);if(n==0)break;/*退出成绩查询模块*/if(n==1)ShowAllStudent();/*显示所有成绩*/
8、elseif((i=FindStudent(n))>=0)/*找到学号为n的学生*/{ShowTitle();/*显示表头