ImageVerifierCode 换一换
格式:DOCX , 页数:29 ,大小:195.54KB ,
资源ID:9355280      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/9355280.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C语言学生成绩管理系统设计方案.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C语言学生成绩管理系统设计方案.docx

1、C语言学生成绩管理系统设计方案学生成绩管理系统1 系统分析1.1 课程设计容设计一学生成绩管理系统,功能包括:1. 输入数据:可输入学生、学号、及多门(至少 5 门)课程的成绩。(先将所 有学生的、学号输入完后,再逐科输入成绩)2.3.4.5.6.7.编辑数据:可添加、删除、修改数据。计算:计算出每个学生的总分及平均成绩;计算每门课程平均成绩。 查询:可按、学号查询;可查询不及格的学生。排序:可按、学号、总分排序浏览:可浏览输入、查询或排序后的数据。文件操作:可打开、保存、关闭数据文件。1.2 系统功能需求分析本系统应具有以下功能:1、数据输入功能:可输入学生人数、 学号、数学成绩、英语成绩,

2、语文成 绩、物理成绩、电脑成绩,输入后自动保存学生数据。2、数据添加、修改、删除功能:可以添加多名学生信息,包括、学号、各 科成绩等待,可以修改某学生的全部信息,也可以删除某学生的全部信 息。3、计算功能:可以计算出每个学生的总分以及平均成绩,也可以计算出全 部学生的各科的平均成绩。4、查询功能:可按、学号查询到某个学生的信息,可以输出不及格的学生。 5、排序功能:可以按学生、学号、总分对全部学生排序。6、浏览功能:可浏览输入、查询或排序后的数据。7、文件功能:可以新建文件,打开文件。8、关闭系统。2 系统设计2.1 总体设计按系统分析的功能要求将系统划分为以下几个主要功能模块:2.2 详细设

3、计1、主函数 main()利用 While 循环语句和 switch()实现各函数的调用,系统根据输入的数字选项来调用相 应的函数。2、菜单函数 menu()通过菜单函数显示可选择的菜单,每次操作完后按任意键回到菜单函数。3、新建文件函数 new_file()通过该函数实现新建文件、输入学生数据功能。4、编辑数据函数 edit_data()该函数下还有 3 个函数,通过 switch()功能去选择其包含 3 个函数去实现不 同的功能。3 个函数分别是 添加学生数据函数 add_data()、删除学生信息函数 del_data()、修改学生信息函数 mod_data()。5、计算函数 calcu

4、late ()通过该函数计算每个学生的平均成绩及总成绩,计算出每科的平均成绩,并 显示出来。6、查询函数 search()该函数包含 3 个子涵数,分别按照查询函数 search_name():、按照学号查 询函数 search_num()、查询不及格函数 search_fail()。通过 switch()来选这 3 个函数去实现不同的查询功能。7、排序函数 sort()该函数包含 3 个子函数,分别按照排序函数 sort_name()、按照学号排序函 数 sort_num()、按照分数高低排序函数 sort_score(),通过 switch()来选择这 3 个函数,每个函数排序好后会显示出

5、来。8、浏览函数 browse()通过该函数可以查看可浏览输入、查询或排序后的数据。9、打开文件函数 open_file()通过该函数可以打开已经保存的文件,查看里面的数据。10、保存函数 save()把该函数放在子函数末尾,比如放在排序函数,编辑函数等函数容的末尾, 这个就可以实现将修改后的数据保存下来。11、清屏函数 clrscr()通过该函数可以独立显示每个函数的容。12、返回菜单函数 return_menu()这个函数反正子函数里面,当子函数操作完后,通过该函数可按任意键返回 到目录。13、定义一个结构体 struct student stuSIZE这样就可以将不同类型的数组组合成一个

6、有机的整体,以便引用,还可以通 过 SIZE 的大小来控制最多可输入的学生人数。3 系统运行菜单界面:输入数据:删除数据:计算数据:按排序后的数据:按排序:打开文件:4 总结本次设计达到了设计要求的基本容,各功能都能正常运行,设计的系统使用 方法容易理解,界面清晰但不够华丽,没有设计到要求以外的其它功能。设计过程中文件操作这一部分把我难住了,由于之前没有系统地去学这一 块,自己只有看书,问同学来了解,搞了很久才完成这一块。还有输入错误检查 这一部分做得不好。通过一个多星期的 C 语言课程设计,感觉自己收获了不少。首先学会了一些 书本没学到的函数,比如 clrscr()等。我对各函数的作用有更加

7、进一步的了解, 熟悉了函数之间的调用关系。懂得了冷静地去处理编译时出现的问题。从这里我 也得到一个体会,做一个程序,或者开发一个软件,应该着重从它的后台制作入 手,不能做出一个中看不中用的程序或者软件,写的程序往往是很长的,有时候 面对几百行的程序甚至数千行的程序,自己也会看傻,这就需要我们在设计时要 有耐心,适当地做下注释。这次课程设计对我以后在单片机编程这一块打下了很好的基础,对我以后的 学习有很大的帮助。参考文献C 程序设计(第三版)谭浩强 编著C 程序设计题解与上机指导(第三版)谭浩强 编著附录:代码#include stdio.h #include #include #define

8、SIZE 100int i,number;/* 包含 exit()*/FILE *fp,*fp1;struct studentchar name20;char num10;int math;int english;int Chinese;int physics;int computer;int total;int average;stuSIZE;void save()/*将数据储存于文件*/FILE *fp;int j;if(fp=fopen(stu_list,wb)=NULL)printf(cannot open filen);return;for(j=0;jSIZE;j+)if(fwrit

9、e(&stuj,sizeof(struct student),1,fp)!=1) printf(file write errorn);fclose(fp);void return_menu() /*返回菜单*/printf(nntPress any key to return to menu.); getch();void menu()/*菜单*/int i;clrscr();gotoxy(1,3); for(i=0;i37;i+)printf( *);printf(nnn 1.Set up new filen); printf( 2.Edit datan);printf( 3.Calcula

10、tionn);printf( 4.Searchn);printf( 5.Sortn);printf( 6.Browsen);printf( 7.Open filen);printf( 0.exitn);printf(nn);for(i=0;i37;i+)printf( *);printf(nn Please select the menu:);void new_file()/* 输入数据*/int i,j,sum;char file_name10;for(i=0;i37;i+)printf(* );clrscr();printf(nn Please input the file name:);

11、scanf(%s,&file_name);fp=fopen(file_name, w); /* 向文件写数据*/printf(n Successed to creat file);printf(nn Please input the number of students: );scanf(%d,&number);for(i=0;inumber;i+)printf(n Please input the name of the student:); scanf(%s, stui.name);printf( Please input the number of students learning:

12、); scanf(%s, stui.num);printf( Please input the mathematics score:);scanf(%d, &stui.math);printf( Please input English score:);scanf(%d, &stui.english);printf( Please input the mathematics score:);scanf(%d, &stui.Chinese);printf( Please input the physical score:);scanf(%d, &stui.physics);printf( Ple

13、ase input the computer score:);scanf(%d, &puter);fprintf(fp,%d,number);for(i=0;inumber;i+)fprintf(fp,n%s %s %d %d %d %d %d,stui.name,stui .num,stui.math,stui.e nglish,stui.Chinese,stui.physics,puter); /*将学生信息输出到 文件上*/fclose(fp); /*关闭文件*/*save();*/printf(nn Press any key to return to the menu);getch(

14、);void edit_data() /*编辑数据*/void add_data();void del_data();void mod_data();int i;clrscr();printf(nn 1.Add datan);printf( 2.Delete datan);printf( 3.Modify data n);printf( 4.Return to menun);printf(nn You choice is:);scanf(%d,&i);switch(i)case 1:add_data();break;case 2:del_data();break;case 3:mod_data

15、();break;case 4:return_menu();break;default:printf(No this choice);void add_data() /*添加数据*/int i,n;char fname10;clrscr();printf(nntPlease input the file name which you want to add data:); scanf(%s,fname);fp=fopen(fname,r);/*读入文件*/fscanf(fp,%d,&number); /*从文件读出学生人数*/ for(i=0;inumber;i+)fscanf(fp,%s %

16、s %d %d %d %d %d,stui.name,stui.num,&stui.math,&stui .english,&stui.Chinese,&stui.physics,&puter); /*从文件读入 学生各项信息*/fclose(fp);printf(nn Please input the add number of students: );scanf(%d,&n);for(i=number;inumber+n;i+)printf(n Please input the name of the student:);scanf(%s, stui.name);printf( Pleas

17、e input the number of students learning: );scanf(%s, stui.num);printf( Please input the mathematics score:);scanf(%d, &stui.math);printf( Please input English score:);scanf(%d, &stui.english);printf( Please input the mathematics score:);scanf(%d, &stui.Chinese);printf( Please input the physical scor

18、e:);scanf(%d, &stui.physics);printf( Please input the computer score:);scanf(%d, &puter);number=number+n;fp=fopen(fname,w);fprintf(fp,%d,number);for(i=0;inumber;i+) /*将学生信息输出到文件上*/fprintf(fp,%s %s %d%d %d %d %d,stui.name,stui .num,stui.math,stui.english,stui.Chine se,stui.physics,stui .computer);fcl

19、ose(fp);save();printf(nn Press any key to return to the menu);getch();void del_data() /* 删除数据*/int i,k,n;char name10,c;char fname10;clrscr();printf(nntPlease input the file name which you want to delete data:); scanf(%s,fname);fp=fopen(fname,r); fscanf(fp,%d,&number); for(i=0;inumber;i+)/*把学生信息读进来*/

20、fscanf(fp,%s %s %d %d %d %d %d,stui.name,stui.num,&stui.math,&stui .english,&stui.Chinese,&stui.physics,&puter);fclose(fp);printf(toriginal data:);printf(nnname num math englis Chinese physics computern);for(i=0;inumber;i+)printf(%-10s%-10s%-10d%-10d%-10d%-10d%-10dn ,stui.name,stui.num,stui .math,st

21、ui.english,stui.Chinese,stui.physics,stui .computer);printf(ntPlease input the students name which you want to delete: ); scanf(%s,name);for(i=0;inumber;i+)if(strcmp(name,stui.name)=0)/*将学生信息向前移一位*/strcpy(stui.name,stui+1.name);strcpy(stui.num,stui+1 .num);stui.math=stui+1.math;stui.english=stui+1.e

22、nglish;stui.Chinese=stui+1.Chinese;stui.physics=stui+1.physics;puter=stui+puter;printf(ntthe new data:);printf(nnname num math englis Chinese physics computern);for(i=0;inumber-1;i+)printf(%-10s%-10s%-10d%-10d%-10d%-10d%-10dn ,stui.name,stui .num,stui.ma th,stui.english,stui .Chinese,stui.physics,st

23、ui .computer);number-;fp=fopen(fname,w);fprintf(fp,%d,number);for(i=0;inumber;i+) fprintf(fp,%s %s %d/*将删除后的信息写到文件上*/%d %d %d %d,stui.name,stui .num,stui.math,stui.english,stui.Chine se,stui.physics,stui .computer);fclose(fp);save();printf(nn Press any key to return to the menu); getch();void mod_da

24、ta()/*修改数据*/char name10;char fname10;clrscr();printf(nntPlease input the file name which you want to modify data:); scanf(%s,fname);fp=fopen(fname,r);fscanf(fp,%d,&number);for(i=0;inumber;i+)fscanf(fp,%s %s %d %d %d %d %d,stui.name,stui.num,&stui.math,&stui .english,&stui.Chinese,&stui.physics,&pute

25、r);fclose(fp);clrscr();printf(nn Please input the students name who you want to modify:); scanf(%s,name);for(i=0;inumber;i+)if(strcmp(name,stui.name)=0)printf(n Please input the new name of the student:);scanf(%s, stui.name);printf( Please input the new number of students learning: ); scanf(%s, stui

26、.num);printf( Please input the new mathematics score:);scanf(%d, &stui.math);printf( Please input new English score:);scanf(%d, &stui.english);printf( Please input the new mathematics score:);scanf(%d, &stui.Chinese);printf( Please input the new physical score:);scanf(%d, &stui.physics);printf( Plea

27、se input the new computer score:);scanf(%d, &puter);fp=fopen(fname,w);fprintf(fp,%d,number);for(i=0;inumber;i+)fprintf(fp,%s %s %d%d %d %d %d,stui.name,stui .num,stui.math,stui.english,stui.Chine se,stui.physics,stui .computer);fclose(fp);save();printf(nn Press any key to return to the menu);getch()

28、;void calculate (int n) /*计算*/int i,math_ave=0,english_ave=0,chinese_ave=0,physics_ave=0,computer_ave =0; clrscr();printf(nnEvery students total score and average score are:nn); printf(name tatal averagen);for(i=0;in;i+)stui.total=stui.math+stui.english+stui.Chinese+stui.physics+stui .computer;stui.average=stui.total/5;printf( %-10s %-10d %-10dn,stui.name,stui .total,stui.average);for(i=0;in;i+)math_ave=(math_ave+stui.math);math_ave=(math_ave/n);for(i=0;in;i+)english_ave=(english_ave+stui

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1