c语言课程设计学生学籍管理系统_第1页
c语言课程设计学生学籍管理系统_第2页
c语言课程设计学生学籍管理系统_第3页
c语言课程设计学生学籍管理系统_第4页
c语言课程设计学生学籍管理系统_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、#in clude#in clude#in clude#defi ne stu 30int menu (void);void readche ngji(lo ng xuehao,float che ngji,i nt n);void aversumofche ngji(float xuehao,i nt n);void desortbyche ngji(l ong xuehao,float che ngji,i nt n);void assortbyxuehao(l ong xuehao,float che ngji,i nt n);void searchbyxuehao(l ong xueh

2、ao,float che ngji,i nt n);void statistica nalysis(float che ngji,i nt n);void prin tche ngji(l ong xuehao,float che ngji,i nt n);int mai n ()char itemSelected;char mima10;int n ,j=0;float che ngjistu;long xuehaostu;char yaosi=6251;char c;printf(ttt学生成绩管理系统n);printf(请输入密码:”);ago:j=0;while(c=getch()!=

3、13)putchar(*);mimaj=c;j+;mimaj=0;getchar();if (strcmp(mima,yaosi)=0)goto loop;elseprintf(密码错误,请重新输入:);prin tf(a);prin tf(a);prin tf(a);goto ago;loop:printf(输入学生人数 n stu)printf(输入错误,请重新输入:);prin tf(a);prin tf(a);prin tf(a);goto shuru;while (1)/当非零的时候/itemSelected=me nu();显示菜单,并读取用户输入/switch (itemSele

4、cted)case 1: readche ngji(xuehao,che ngji ,n);break;case 2: aversumofche ngji(che ngji, n);break;case 3:desortbyche ngji(xuehao,che ngji, n);printf(n成绩降序排列:n学号t成绩n”);prin tche ngji(xuehao,che ngji, n);break;case 4: assortbyxuehao(xuehao,che ngji, n);printf(n学号升序排列:n学号t成绩n”);prin tche ngji(xuehao,che

5、 ngji, n);break;case 5: searchbyxuehao(xuehao,che ngji, n);break;case 6: statistica nalysis(che ngji, n);break;case 7: prin tche ngji(xuehao,che ngji, n);break;case 0: exit(0);printf(程序结束!);break;default:printf(输入错误! ”);break;return 0;/函数功能:显示菜单并获得用户键盘输入的选项/int menu (void)int itemSelected;printf(n学生

6、成绩的管理n);printf(t1.学号成绩录入n);prin tf(t2 计算总分和平均分n);printf(t3.根据成绩降序排列n);printf(t4.按照学号升序排列n);printf(t5.按学号查询 n);printf(t6.统计分析 n);printf(t7.列表记录 n);printf(t0.退出 n); printf(请输入你的选择:);scan f(%d, &itemSelected); return itemSelected;输入n个学生的某门课成绩/void readche ngji(lo ng xuehao,float che ngji,i nt n)int i;p

7、rintf(输入学生学号,成绩:n);for (i=0;i n ;i+)scan f(%ld%f, &xuehaoi,&chen gjii);计算全班总分和平均分 void aversumofche ngji(float che ngji,i nt n)int i;float sum=0;for(i=0;i0?sum/n:0);/按选择法将数组chengji的元素按从高到低排序/void desortbyche ngji(l ong xuehao,float che ngji,i nt n)int i,j,k;float templ1;long templ2;for (i=0;i=n _1;i

8、+)k=i;for(j=i+1;jche ngjik)k=j;if (k!=i)tempi仁che ngjik;che ngjik=che ngjii;chengjii=templ1; 交换成绩 / templ2=xuehaok;xuehaok=xuehaoi;xuehaoi=templ2; 交换学号 /按选择法将数组xuehao的元素值按从低到高排序/ void assortbyxuehao(l ong xuehao,float che ngji,i nt n) int i,j,k;float n1;long n2;for (i=0;i=n _1;i+)k=i;for(j=i+1;j n;j

9、+)if(xuehaojxuehaok)k=j;if (k!=i)n 1=che ngjik;che ngjik=che ngjii;chengjii=n1; 交换成绩 /n 2=xuehaok;xuehaok=xuehaoi;xuehaoi=n2; 交换学号 /按学号查找学生成绩并显示查找结果/void searchbyxuehao(l ong xuehao,float che ngji,i nt n) long nu mber;int i;printf(输入你要查询的学号:”);scan f(%ld, &n umber);for (i=0;i n ;i+)if(xuehaoi=nu mbe

10、r)prin tf(%ldt%.0fn,xuehaoi,che ngjii); return;printf(n 未查询到! n);/统计各分数段的学生人数及所占的百分比/void statistica nalysis(float che ngji,i nt n)int i,total=0,t6=0,0,0,0,0,0;for (i=0;i =0&che ngjii60)t0+;else if(che ngjii70)t1+;else if(che ngjii80)t2+;else if(che ngjii90)t3+;else if(che ngjii100)t4+;else if(che ngjii=100)t5+;for(i=0;i=5;i+)total=total+ti;if(total!=n)printf(成绩输入不在正确的范围”);return;printf(n分数段t人数t百分比n);for(i=0;i=5;i+)if(i=0)prin tf(60t%dt%.2f%n,ti,(float)ti/n*100);else if(i=5)prin tf(%dt%dt%.2f%n,(i+5)*10, ti ,(float)ti/n*100);elseprin tf(%d-%dt%d

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论