C语言大作业(成绩管理系统)参考模板_第1页
C语言大作业(成绩管理系统)参考模板_第2页
C语言大作业(成绩管理系统)参考模板_第3页
C语言大作业(成绩管理系统)参考模板_第4页
C语言大作业(成绩管理系统)参考模板_第5页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

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

文档简介

1、C语言大作业(成绩管理系统)制作人:皇家战盾 2016年12月31日1 / 29 ;结束quanbanchengjishuchu()lianxilaoshichenggongxuehaookxuehaoxuehaoxiugai()Paixu()chaxun()shanchu()xiugai()tianjia()gerenchengji()xgerengaofen()chengji()teacher()student()xuehao=stuixuehaochenggongny=aidenglu()zhuce()菜单选择菜单显示开始流程图:信息结构体中包括:学号、姓名、英语成绩、高数成绩、大物成绩

2、、C语言成绩、机械制图成绩、政治成绩、体育成绩、总成绩、平均分。源程序代码#include#include struct studentint num; 学号char name100; 姓名int score1; 英语int score2; 高数int score3; 大物int score4; C语言int score5; 机械制图int score6; 政治int score7; 体育int score8; 总成绩int score9; 平均分stu100;int R;int xuehao;double ping10;int gao10;void denglu(); 登录函数void st

3、udent(); 学生登录界面函数void teacher(); 教师登录界面函数void chengji();void quanbanchengjishuchu(); 调用全班各科成绩、总分、平均分进行输出函数void tianjia(); 教师使用添加学生成绩函数void xiugai(); 教师使用修改学生成绩函数void input(); 教师修改成绩将成绩录入文档函数void shanchu(); 教师删除学生信息及成绩函数void gerenchengji(); 输出显示学生个人成绩void zhuce(); 学生登录注册函数 void pingjun(); 成绩计算平均分void

4、 chaxun(); 教师使用按学号查询学生个人成绩void xuehaopaixu(); 按学号顺序显示个人成绩void gerengaofen(); 学生使用查询各科最高分void zuigaofen(); 显示各科最高分分数void ps1(); 英语成绩排序void ps2(); 高数成绩排序void ps3(); 大物成绩排序void ps4(); C语言成绩排序void ps5(); 工图成绩排序void ps6(); 政治成绩排序void ps7(); 体育成绩排序void pz(); 总成绩排序void xueshengpaiming(int number); 学生查看自己在全

5、班排名main()int x;system(cls);chengji();pingjun();zuigaofen();system(cls);printf(n*欢迎使用本成绩管理系统*nn请选择功能:n1.登录n2.注册n您选择的功能编号为:);scanf(%d,&x);if(x=1)denglu();else if(x=2)zhuce();else printf(请正确选择!);void denglu()int a100,b100,c100,i,y,m,n;char w;FILE * fp;fp = fopen(zhanghao.txt,r);for(i=0;i1000;i+)fscanf(

6、fp,%d%d%d,&ai,&bi,&ci);fclose(fp);again:system(cls);printf(n*请输入您的用户名和密码*nn用户名:);scanf(%d,&y);for(i=0;i1000;i+)n=i;if(y=ai)goto chenggong;printf(用户名不存在,请正确输入!);goto again;chenggong:printf(密码:);scanf(%d,&m);if(m=bn)printf(登录成功!);elseprintf(请正确输入!);scanf(%c,&w);scanf(%c,&w);goto again;xuehao = cn;for(

7、i=0;iR;i+)if(xuehao=stui.num)goto ok;if(xuehao=1)goto ok;printf(n此学生以被老师删除,请联系老师);printf(按回车键返回);scanf(%c,&w);scanf(%c,&w);main();ok:if(cn=1)teacher();else student();void student()int i,k,x;chengji();system(cls);for(i=0;i1000;i+)k=i;if(xuehao=stui.num)goto ok;ok:printf(n*欢迎使用本系统*nn你好! %s 同学nn,stuk.n

8、ame);printf(请选择功能n1.本人成绩查询n2.各科最高分查询nn*如需退出请直接关闭*n);scanf(%d,&x);if(x=1)gerenchengji();if(x=2)gerengaofen();void teacher()int x;system(cls);chengji();xuehaopaixu();pingjun();printf(n*欢迎敬爱的老师使用本系统*nn);printf(请选择您需要的功能:n1.学生管理n2.成绩管理nn*如需退出请直接关闭*n);scanf(%d,&x);if(x=1)system(cls);printf(n*欢迎敬爱的老师使用本系统

9、*nn请选择您需要对学生所做的操作n1.添加某学生数据n2.修改某学生数据n3.删除某学生数据n4.返回n);scanf(%d,&x);switch(x)case 1:tianjia();case 2:xiugai();case 3:shanchu();case 4:teacher();else if(x=2)system(cls);printf(n*欢迎敬爱的老师使用本系统*nn请选择您需要对成绩所做的操作n1.查看全班学生的考试成绩n2.修改某学生的考试成绩n3.查看全班学生的排名n4.按学号查询某学生的成绩n5.返回n);scanf(%d,&x);switch(x)case 1:quan

10、banchengjishuchu();case 2:xiugai();case 3:printf(请选择排序方式:n1.按总分排序n2.按英语成绩排序n3.按高等数学成绩排序n4.按大学物理成绩排序n5.按c语言成绩排序n6.按机械制图成绩排序n7.按政治成绩排序n8.按体育成绩排序n);/英语、高等数学、大学物理、C语言、机械制图、政治、体育scanf(%d,&x);switch (x)case 1:pz();quanbanchengjishuchu();case 2:ps1();quanbanchengjishuchu();case 3:ps2();quanbanchengjishuchu

11、();case 4:ps3();quanbanchengjishuchu();case 5:ps4();quanbanchengjishuchu();case 6:ps5();quanbanchengjishuchu();case 7:ps6();quanbanchengjishuchu();case 8:ps7();quanbanchengjishuchu();case 4:chaxun();case 5:teacher();else ;return 0;void chengji()int i;FILE * fp1;FILE * fp2;FILE * fp3;fp1 = fopen(chen

12、gji.txt,r);fp2 = fopen(name.txt,r);fp3 = fopen(renshu.txt,r);fscanf(fp3,%d,&R);printf(目前本成绩管理系统所存学生人数为%d人n,R);for(i=0;iR;i+)fscanf(fp1,%d,&stui.num);fscanf(fp2,%s,);fscanf(fp1,%d,&stui.score1);fscanf(fp1,%d,&stui.score2);fscanf(fp1,%d,&stui.score3);fscanf(fp1,%d,&stui.score4);fscanf(fp1,%d,

13、&stui.score5);fscanf(fp1,%d,&stui.score6);fscanf(fp1,%d,&stui.score7);fscanf(fp1,%d,&stui.score8);fscanf(fp1,%d,&stui.score9);stui.score8=stui.score1+stui.score2+stui.score3+stui.score4+stui.score5+stui.score6+stui.score7;stui.score9=(stui.score1+stui.score2+stui.score3+stui.score4+stui.score5+stui.

14、score6+stui.score7)/7;fclose(fp1);fclose(fp2);fclose(fp3);void quanbanchengjishuchu()int i;char w;system(cls);printf(学号t姓名t1.英语t2.高数t3.大物t4.C语言t5.机械制图t6.政治t7.体育t总成绩tt平均分n);for(i=0;iR;i+)printf(%dt,stui.num);printf(%st,);printf(%dt,stui.score1);printf(%dt,stui.score2);printf(%dt,stui.score3)

15、;printf(%dt,stui.score4);printf(%dtt,stui.score5);printf(%dt,stui.score6);printf(%dt,stui.score7);printf(%dtt,stui.score8);printf(%dtn,stui.score9);printf(全班平均成绩t%.2lft%.2lft%.2lft%.2lft%.2lftt%.2lft%.2lft%.2lftt%.2lfn,ping1,ping2,ping3,ping4,ping5,ping6,ping7,ping8,ping9);printf(按回车键返回);scanf(%c,&w

16、);scanf(%c,&w);teacher();void tianjia()int a10,i;char b1100,w;FILE * fp1;FILE * fp2;FILE * fp3;fp1 = fopen(chengji.txt,a);fp2 = fopen(name.txt,a);fp3 = fopen(renshu.txt,w);printf(清输入这名学生的学号n);scanf(%d,&a0);for(i=0;iR;i+)if(a0=stui.num)printf(以存在此学生!n);printf(按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher

17、();fprintf(fp1,%dn,a0);printf(清输入这名学生的姓名n);scanf(%s,b0);fprintf(fp2,%sn,b0);printf(清输入这名学生的英语成绩n);scanf(%d,&a1);fprintf(fp1,%dn,a1);printf(清输入这名学生的高等数学成绩n);scanf(%d,&a2);fprintf(fp1,%dn,a2);printf(清输入这名学生的大学物理成绩n);scanf(%d,&a3);fprintf(fp1,%dn,a3);printf(清输入这名学生的C语言成绩n);scanf(%d,&a4);fprintf(fp1,%dn

18、,a4);printf(清输入这名学生的机械制图成绩n);scanf(%d,&a5);fprintf(fp1,%dn,a5);printf(清输入这名学生的政治成绩n);scanf(%d,&a6);fprintf(fp1,%dn,a6);printf(清输入这名学生的体育成绩n);scanf(%d,&a7);fprintf(fp1,%dn,a7);a8=a1+a2+a3+a4+a5+a6+a7;fprintf(fp1,%dn,a8);a9=(a1+a2+a3+a4+a5+a6+a7)/7;fprintf(fp1,%dn,a9);R=R+1;printf(现在此系统中共存的学生人数有%d人,R)

19、;fprintf(fp3,%d,R);/英语、高等数学、大学物理、C语言、机械制图、政治、体育fclose(fp1);fclose(fp2);fclose(fp3);printf(添加成功!按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher();void xiugai()int n,m,i,s,p,k,w;chengji();printf(您需要输入这名学生的学号和要修改的科目编号,之后进行修改n请输入这名学生的学号:);scanf(%d,&n);for(i=0;iR;i+)if(n=stui.num)goto ok;printf(并不存在此学生!n);prin

20、tf(按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher();ok:printf(1.英语tt2.高等数学t3.大学物理t4.C语言tt5.机械制图t6.政治t7.体育nn);printf(您需要输入这名学生要修改的科目编号:);scanf(%d,&m);for(i=0;iR;i+)if(n=stui.num)k=i;switch(m)case 1:printf(n请您确认您是要修改%s的英语成绩吗?n目前ta的英语成绩为%dnn请输入n1.确认 2.取消n,,stui.score1);break;break;case 2:printf(n请您

21、确认您是要修改%s的高等数学成绩吗?n目前ta的高等数学成绩为%dnn请输入n1.确认 2.取消n,,stui.score2);break;break;case 3:printf(n请您确认您是要修改%s的大学物理成绩吗?n目前ta的大学物理成绩为%dnn请输入n1.确认 2.取消n,,stui.score3);break;break;case 4:printf(n请您确认您是要修改%s的C语言成绩吗?n目前ta的C语言成绩为%dnn请输入n1.确认 2.取消n,,stui.score4);break;break;case 5:printf

22、(n请您确认您是要修改%s的机械制图成绩吗?n目前ta的机械制图成绩为%dnn请输入n1.确认 2.取消n,,stui.score5);break;break;case 6:printf(n请您确认您是要修改%s的政治成绩吗?n目前ta的政治成绩为%dnn请输入n1.确认 2.取消n,,stui.score6);break;break;case 7:printf(n请您确认您是要修改%s的体育成绩吗?n目前ta的体育成绩为%dnn请输入n1.确认 2.取消n,,stui.score7);break;break;/英语、高等数学、大学物理、C

23、语言、机械制图、政治、体育if(m!=1&m!=2&m!=3&m!=4&m!=5&m!=6&m!=7)printf(请正确选择);scanf(%c,&w);scanf(%c,&w);goto ok;scanf(%d,&p);if(p=1)printf(请输入ta的新成绩:);scanf(%d,&s);printf(ta的此课程的新成绩为%d,s);switch(m)case 1:stuk.score1=s;goto shuchu;case 2:stuk.score2=s;goto shuchu;case 3:stuk.score3=s;goto shuchu;case 4:stuk.score

24、4=s;goto shuchu;case 5:stuk.score5=s;goto shuchu;case 6:stuk.score6=s;goto shuchu;case 7:stuk.score7=s;goto shuchu;case 8:stuk.score8=s;goto shuchu;case 9:stuk.score9=s;goto shuchu;else if(p=2)printf(以取消n按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher();elseprintf(请正确选择!);shuchu:input();void input()int i;

25、char w;FILE * fp1;FILE * fp2;FILE * fp3;fp1 = fopen(chengji.txt,w);fclose(fp1);fp2 = fopen(name.txt,w);fclose(fp2);fp1 = fopen(chengji.txt,a);fp2 = fopen(name.txt,a);fp3 = fopen(renshu.txt,w);for(i=0;iR;i+)fprintf(fp1,%dn,stui.num);fprintf(fp2,%sn,);fprintf(fp1,%dn,stui.score1);fprintf(fp1,

26、%dn,stui.score2);fprintf(fp1,%dn,stui.score3);fprintf(fp1,%dn,stui.score4);fprintf(fp1,%dn,stui.score5);fprintf(fp1,%dn,stui.score6);fprintf(fp1,%dn,stui.score7);stui.score8=stui.score1+stui.score2+stui.score3+stui.score4+stui.score5+stui.score6+stui.score7;fprintf(fp1,%dn,stui.score8);stui.score9=(

27、stui.score1+stui.score2+stui.score3+stui.score4+stui.score5+stui.score6+stui.score7)/7;fprintf(fp1,%dn,stui.score9);fprintf(fp3,%d,R);fclose(fp1);fclose(fp2);fclose(fp3);printf(n按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher();void shanchu()int i,n,k,x;char w;printf(请输入要删除学生的学号:);scanf(%d,&n);for(i=0;iR;

28、i+)if(n=stui.num)goto cunzai;printf(不存在此学号的学生!n);printf(按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher();cunzai:for(i=0;iR;i+)k=i;if(n=stui.num)printf(请确认要删除%s的成绩数据吗?n1.确认 2.取消,);scanf(%d,&x);if(x=1)goto ok;else if(x=2)printf(以取消,按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher();elseprintf(请正确选择!);ok:

29、R=R-1;for(i=k;iR;i+)stui=stui+1;stui+1=stui+2;input();printf(按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher();void gerenchengji()int k,i;char w;for(i=0;i1000;i+)k=i;if(xuehao=stui.num)goto ok;ok:printf(学号t姓名t1.英语t2.高数t3.大物t4.C语言t5.机械制图t6.政治t7.体育t总成绩tt平均分n);printf(%dt,stuk.num);printf(%st,);print

30、f(%dt,stuk.score1);printf(%dt,stuk.score2);printf(%dt,stuk.score3);printf(%dt,stuk.score4);printf(%dtt,stuk.score5);printf(%dt,stuk.score6);printf(%dt,stuk.score7);printf(%dtt,stuk.score8);printf(%dtn,stuk.score9);printf(全班平均成绩t%.2lft%.2lft%.2lft%.2lft%.2lftt%.2lft%.2lft%.2lftt%.2lfn,ping1,ping2,pin

31、g3,ping4,ping5,ping6,ping7,ping8,ping9); xueshengpaiming(k);printf(按回车键返回);scanf(%c,&w);scanf(%c,&w);student();void zhuce()int n,y,m,i,a100,b100,c100;char w;FILE * fp;fp = fopen(zhanghao.txt,r);for(i=0;i1000;i+)fscanf(fp,%d%d%d,&ai,&bi,&ci);fclose(fp);printf(请输入学号:);scanf(%d,&n);for(i=0;iR;i+)if(ci=

32、n)printf(此学号已被注册请重新登录n按任意键返回开始界面);scanf(%c,&w);scanf(%c,&w);main();break;for(i=0;iR;i+)if(n=stui.num)goto ok;printf(此学号未在成绩系统内,请联系老师添加此学号n);printf(按回车键返回);scanf(%c,&w);scanf(%c,&w);main();ok:printf(此学号可以注册!n请输入用户名(数字)和密码(数字)创建新用户n用户名:);scanf(%d,&y);for(i=0;iR;i+)if(y=ai)printf(此用户名以被注册,请换一个从新输入);got

33、o ok;printf(密码:);scanf(%d,&m);fp = fopen(zhanghao.txt,a);fprintf(fp,n%dn%dn%d,y,m,n);fclose(fp);printf(注册成功!请关闭从新登陆n);void pingjun()int h10,i;for(i=0;i10;i+)hi=0;for(i=0;iR;i+)h1=h1+stui.score1;h2=h2+stui.score2;h3=h3+stui.score3;h4=h4+stui.score4;h5=h5+stui.score5;h6=h6+stui.score6;h7=h7+stui.score

34、7;h8=h8+stui.score8;h9=h9+stui.score9;ping1=1.0*h1/R;ping2=1.0*h2/R;ping3=1.0*h3/R;ping4=1.0*h4/R;ping5=1.0*h5/R;ping6=1.0*h6/R;ping7=1.0*h7/R;ping8=1.0*h8/R;ping9=1.0*h9/R;void chaxun()int n,k,i;char w;printf(请输入需要查询的学生的学号:);scanf(%d,&n);for(i=0;iR;i+)if(n=stui.num)k=i;goto ok;printf(并不存在此学生!n);pri

35、ntf(按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher();ok:printf(学号t姓名t1.英语t2.高数t3.大物t4.C语言t5.机械制图t6.政治t7.体育t总成绩t平均分n);printf(%dt,stuk.num);printf(%st,);printf(%dt,stuk.score1);printf(%dt,stuk.score2);printf(%dt,stuk.score3);printf(%dt,stuk.score4);printf(%dtt,stuk.score5);printf(%dt,stuk.score6);

36、printf(%dt,stuk.score7);printf(%dt,stuk.score8);printf(%dtn,stuk.score9);printf(全班平均成绩t%.2lft%.2lft%.2lft%.2lft%.2lftt%.2lft%.2lft%.2lft%.2lfn,ping1,ping2,ping3,ping4,ping5,ping6,ping7,ping8,ping9);printf(按回车键返回);scanf(%c,&w);scanf(%c,&w);teacher();void zuigaofen()int i,b;for(i=0;i10;i+)gaoi=0;for(i

37、=0;igao1)gao1=stui.score1;if(stui.score2gao2)gao2=stui.score2;if(stui.score3gao3)gao3=stui.score3;if(stui.score4gao4)gao4=stui.score4;if(stui.score5gao5)gao5=stui.score5;if(stui.score6gao6)gao6=stui.score6;if(stui.score7gao7)gao7=stui.score7;if(stui.score8gao8)gao8=stui.score8;if(stui.score9gao9)gao

38、9=stui.score9;void gerengaofen()int k,i;char w;for(i=0;i1000;i+)k=i;if(xuehao=stui.num)goto ok;ok:printf(学号t姓名t1.英语t2.高数t3.大物t4.C语言t5.机械制图t6.政治t7.体育t总成绩t平均分n);printf(%dt,stuk.num);printf(%st,);printf(%dt,stuk.score1);printf(%dt,stuk.score2);printf(%dt,stuk.score3);printf(%dt,stuk.score4);pr

39、intf(%dtt,stuk.score5);printf(%dt,stuk.score6);printf(%dt,stuk.score7);printf(%dt,stuk.score8);printf(%dtn,stuk.score9);printf(全班各课最高分t%dt%dt%dt%dt%dtt%dt%dt%dt%dn,gao1,gao2,gao3,gao4,gao5,gao6,gao7,gao8,gao9);printf(全班平均成绩t%.2lft%.2lft%.2lft%.2lft%.2lftt%.2lft%.2lft%.2lft%.2lfn,ping1,ping2,ping3,ping4,ping5,ping6,ping7,ping8,ping9);printf(按回车键返回);scanf(%c,&w);scanf(%c,&w);student();void xuehaopaixu()int j,i;for(j=0;jR;j+)for(i=0;istui+1.

温馨提示

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

评论

0/150

提交评论