C语言课程设计-学生综合测评系统 (1).doc

上传人:精*** 文档编号:865417 上传时间:2023-10-05 格式:DOC 页数:35 大小:274.62KB
下载 相关 举报
C语言课程设计-学生综合测评系统 (1).doc_第1页
第1页 / 共35页
C语言课程设计-学生综合测评系统 (1).doc_第2页
第2页 / 共35页
C语言课程设计-学生综合测评系统 (1).doc_第3页
第3页 / 共35页
C语言课程设计-学生综合测评系统 (1).doc_第4页
第4页 / 共35页
C语言课程设计-学生综合测评系统 (1).doc_第5页
第5页 / 共35页
点击查看更多>>
资源描述

1、目录一、设计内容与设计要求3学生综合测评系统3一、问题描述:3二、功能描述:3三、算法提示:3四、测试数据:4二设计要求:4三进度安排4四总体设计方案51.总体流程图52.程序主要函数51.void inti() 初始化函数52.welcome() 函数53.void InputInfo() 录入学生信息64.void DeleteInfo() 删除信息75.void paiming1() / void paiming2() 成绩排名76.void ViewAll() 浏览全部学生信息77.void clean() 清除所有信息88. void PaimingView() 查询排名83.程序其

2、他函数8A.信息存盘(结构体)8B.读取信息(结构体)8C.信息存盘(整型)8D.读取信息(整型)8E.学号检索9五程序源代码10六.收获及体会22七.参考文献22计算机与通信学院课程设计评分表23课程名称: C语言程序设计23一、设计内容与设计要求 学生综合测评系统一、问题描述:每个学生的信息为:学号、姓名、性别、家庭住址、联系电话、语文、数学、外语三门单科成绩、考试平均成绩、考试名次、同学互评分、品德成绩、任课教师评分、综合测评总分、综合测评名次。考试平均成绩、同学互评分、品德成绩、任课教师评分分别占综合测评总分的60%,10%,10%,20%。二、功能描述:A、学生信息处理(1) 输入学

3、生信息、学号、姓名、性别、家庭住址、联系电话,按学号以小到大的顺序存入文件中。提示:学生信息可先输入到数组中,排序后可写到文件中。(2) 插入(修改)同学信息:提示:先输入将插入的同学信息,然后再打开源文件并建立新文件,把源文件和输入的信息合并到新文件中(保持按学号有序)若存在该同学则将新记录内容替换源内容,(3) 删除同学信息:提示:输入将删除同学号,读出该同学信息,要求对此进行确认,以决定是否删除将删除后的信息写到文件中。(4) 浏览学生信息:提示:打开文件,显示该文件的学生信息。B、学生数据处理:(1) 按考试科目录入学生成绩并且按公式:考试成绩(语文+数学+外语)/3 计算考试成绩,并

4、计算考试名次,提示:先把学生信息读入数组,然后按提示输入每科成绩,计算考试成绩,求出名次,最后把学生记录写入一个文件中。(2) 学生测评数据输入并计算综合测评总分及名次。提示:综合测评总分(考试成绩)*0.6+(同学互评分)*0.1+品德成绩*0.1+任课老师评分*0.2。(3) 学生数据管理提示:输入学号,读出并显示该同学信息,输入新数据,将改后信息写入文件(4) 学生数据查询:提示:输入学号或其他信息,即读出所有数据信息,并显示出来。C、学生综合信息输出提示:输出学生信息到屏幕。三、算法提示:1、数据结构:结构体类型数组2、数据库结构:下表构成该系统的基本数据库。 学号姓名考试成绩评分Ch

5、arCharstructint四、测试数据:学生人数:N=10 二设计要求:掌握结构化程序设计的主体思想,以自顶向下逐步求精的方法编制程序解决一些实际的问题,为将来编写软件积累一些典型的案例处理经验。(1)按学号顺序选课题号,并在规定的时间内独自完成相关课题的C源程序编写、调试和运行。源程序及编译生成各文件均保存;(2)按本任务书的要求,编写课程设计报告(Word文档格式)。并用A4的复印纸打印并装订; (3)在2013年1月5日之前,请各班学习委员收齐课程设计报告交老师 。附:课程设计报告内容要求如下:封面 课程设计任务书课程设计主文档内容如下:1、 课程设计题目 2、 课程设计目的3、 课

6、程设计主要任务4、 设计环境5、 总体设计方案的选定(主控模块和各子模块的设计方法及框图)6、 源程序清单7、 收获及体会参考资料四、报告内容要求用宋体五号字,主标题用黑三号、一级标题用黑四号字,二级标题用宋体小四号字加粗,要求用A4纸张打印出来。课程设计说明书装订顺序:封面、任务书、正文、附件(A4大小的图纸及程序清单)。 三进度安排第18周,具体安排如下:星期时间班级内容地点第17周任务布置第18周星期三第一次上机机房第18周星期四第二次上机机房第18周星期五第三次上机与答辩机房 湖南工程学院计算机与通信学院 年 月 日 四总体设计方案1.总体流程图开始Welcome函数输入浏览修改删除浏

7、览全部清除全部排名查询排名退出初始化inti函数2.程序主要函数1.void inti() 初始化函数 初始化函数用于从硬盘中加载学生数据和学生数目。首先,从硬盘读取counter.dat的数据。若不存在counter.dat则说明程序第一次运行。创建counter.dat和student_data.dat,把counter的初始值赋为1。若存在counter.dat.则读取其中数据,把数据赋给变量counter,这个值为已储存的学生信息数量。这个counter变量就是计数器变量。用来计量学生信息数量的变化。2.welcome() 函数Welcome函数用来显示选项菜单,并将用户所选的序号返回

8、。主函数中的变量select接收到welcome的返回值。通过开关语句,选择需要使用的功能。3.void InputInfo() 录入学生信息输入学生的信息。学生信息由以下结构体定义。struct student_info int num;/学号char name6;/姓名char sex5;/性别char adress20;/家庭住址char tel10;/电话int chinese,math,english,huping,pingde,jiaoping,paiming1,paiming2; /语文 数学 英语 互评 品德 教评 double ave,zhongping;/ 平均 综合;In

9、putInfo调用input函数。在input函数中的局部变量stu中录入数据,然后input函数返回stu给InputInfo中的结构体数组的counter号元素。然后,InputInfo通过SortInfo();SaveStruct();SaveInt();将数组按学号排序,并存储结构体student和counter。4.void DeleteInfo() 删除信息删除信息函数,从要删除位信息开始,前位用后一位覆盖,直到数组结束。并同时将counter减1。之后调用SaveStruct();SaveInt();储存student结构体数组和counter计数变量。5.void paimin

10、g1() / void paiming2() 成绩排名排名函数将student的给个元素的首地址储存在pN指针数组中。通过冒泡法将指针数组排序。接下来,按顺序把指针数组顺序,把排名赋给student的成员paiming1,paiming2。冒泡排序for(i=0;icounter-1;i+)for(j=i+1;jave ave)temp=pi;pi=pj;pj=temp;排名名词给每一个student的成员paiming1或paiming2。for(i=0;ipaiming1=i+1;6.void ViewAll() 浏览全部学生信息void ViewAll()int i;for(i=0;ic

11、ounter;i+)ViewInfo(&studenti);printf(n);getchar();printf(回车键返回.);getchar();system(cls);7.void clean() 清除所有信息counter计数变量清零,counter.dat清空,student_info.dat清空。8. void PaimingView() 查询排名根据输入的学号查询排名3.程序其他函数A.信息存盘(结构体)void SaveStruct(struct student_info *sp,int size,int n,char filename20)FILE *fp;fp=fopen(

12、filename,wb);fwrite(sp,size,n,fp);fclose(fp);B.读取信息(结构体)void LoadStruct(struct student_info *sp,int size,int n,char filename20)略C.信息存盘(整型)void SaveInt(int *p,int size,int n,char filename20)FILE *fp;fp=fopen(filename,wb);fwrite(p,size,n,fp);fclose(fp);D.读取信息(整型)void LoadInt(int *p,int size,int n,char

13、 filename20)略E.学号检索int NumExist(struct student_info student,int num)int i;for(i=0;icounter;i+)if(studenti.num=num)return i;return -1;检索学号所在的元素下表,若学号存在,则返回该学号所在下标。若学号不存在,则返回-1。程序截图:五程序源代码 学生综合测评系统 2013年1月3日#include#include#define N 100/-函数声明-void init();char welcome();void InputInfo();void view();voi

14、d xiugai();void DeleteInfo();void paiming1(struct student_info student);void paiming2(struct student_info student);void ViewAll();void clean();void PaimingView();void exit();struct student_info input();void SortInfo(struct student_info student);void ViewInfo(struct student_info *sp);void SaveStruct(

15、struct student_info *sp,int size,int n,char filename20);void LoadStruct(struct student_info *sp,int size,int n,char filename20);void SaveInt(int *p,int size,int n,char filename20);void LoadInt(int *p,int size,int n,char filename20);int NumExist(struct student_info student,int num);/-定义学生信息结构体-struct

16、 student_info int num;/学号char name6;/姓名char sex5;/性别char adress20;/家庭住址char tel10;/电话int chinese,math,english,huping,pingde,jiaoping,paiming1,paiming2; /语文 数学 英语 互评 品德 教评 double ave,zhongping;/ 平均 综合/每个学生的信息为:学号、姓名、性别、家庭住址、联系电话、语文、数学、外语三门单科成绩、/考试平均成绩、考试名次、同学互评分、品德成绩、任课教师评分、综合测评总分、综合测评名次。/考试平均成绩、同学互评

17、分、品德成绩、任课教师评分分别占综合测评总分的60%,10%,10%,20%。;/-定义全局结构体数据-struct student_info studentN;int counter,PM;/-主函数-void main()char select;init(); /调用初始化函数while(1)select=welcome();switch(select)case 1:system(cls);InputInfo(); break; /选项1:输入学生信息case 2:system(cls); view(); break; /选项2:浏览学生信息case 3:system(cls);xiuga

18、i(); break; /选项3:修改学生信息case 4:system(cls);DeleteInfo(); break; /选项4:删除学生信息case 5:system(cls); paiming1(student);paiming2(student);PM=1;getchar();getchar();system(cls); break; /选项5:学生信息排名case 6: system(cls); ViewAll();break; /选项6:浏览全部学生信息case 7: system(cls); clean();break;/选项7:清除所有信息case 8: system(cl

19、s); PaimingView();break;/选项8:查询排名case 0:system(cls); exit(); break; /选项9:退出/-初始化函数-void init()FILE *fp;fp=fopen(counter.dat,rb);/打开计数变量counter文件if(fp!=NULL)/载入counterfclose(fp);LoadInt(&counter,sizeof(counter),1,counter.dat);elsefp=fopen(counter.dat,wb);/若没有counter文件,则创建一个,counter初始为0。fclose(fp);cou

20、nter=0;if(counter!=0) /载入学生数据LoadStruct(student,sizeof(struct student_info),counter,student_info.dat);/-欢迎函数-char welcome()char select;while(1)system(cls);printf(tt欢迎使用学生信息管理系统 n);printf(n);printf(1.录入学生信息 nn);printf(2.浏览学生信息 nn);printf(3.修改学生信息 nn);printf(4.删除学生信息 nn);printf(5.排名学生成绩 nn);printf(6.浏

21、览所有学生信息 nn);printf(7.清除所有数据 nn);printf(8.查询排名 nn);printf(0.退出 nn);printf(输入相应的功能序号:);select=getchar();if(select=1|select=2|select=3|select=4|select=5|select=6|select=7|select=8|select=0)return select;system(cls);continue;/-1.录入学生信息-void InputInfo()int i,n;printf(需要录入多少位学生的信息:);scanf(%d,&n);system(cl

22、s);for(i=1;i=n;i+)studentcounter=input();counter+;PM=0;SortInfo(student);SaveStruct(student,sizeof(struct student_info),counter,student_info.dat);SaveInt(&counter,sizeof(counter),1,counter.dat);/-2.游览学生信息-void view()int i,num;printf(请输入需要游览的学生信息的学号:);scanf(%d,&num);getchar();if(i=NumExist(student,nu

23、m)=-1)printf(不存在该学号,按回车键返回.);getchar();system(cls);return;ViewInfo(&studenti);printf(n按回车键返回.);getchar();system(cls);return;/-3.修改学生信息-void xiugai()int i,num;char YN,select;printf(请输入需要修改的学生信息的学号:);scanf(%d,&num);getchar();if(i=NumExist(student,num)=-1)printf(不存在该学号,按回车键返回.);getchar();system(cls);re

24、turn;ViewInfo(&studenti);printf(是否要修改?(Y/N):);scanf(%c,&YN);getchar();if(YN !=Y& YN !=y)printf(修改取消.);getchar();system(cls);return;system(cls);printf(1.学号 n);printf(2.性别 n);printf(3.家庭住址 n);printf(4.联系电话 n);printf(5.语文成绩 n);printf(6.数学成绩 n);printf(7.外语成绩 n);printf(8.同学互评分 n);printf(9.品德成绩 n);printf(

25、0.任课教师教师评分 n);scanf(%c,&select);switch(select)case 1:printf(修改学号:);scanf(%d,&studenti.num);break;case 2:printf(修改性别:);scanf(%s,&studenti.sex);break;case 3:printf(修改家庭住址:);scanf(%s,&studenti.adress);break;case 4:printf(修改联系电话:);scanf(%s,&studenti.tel);break;case 5:printf(修改语文成绩:);scanf(%d,&studenti.c

26、hinese);break;case 6:printf(修改数学成绩:);scanf(%d,&studenti.math);break;case 7:printf(修改外语成绩:);scanf(%d,&studenti.english);break;case 8:printf(修改同学互评分:);scanf(%d,&studenti.huping);break;case 9:printf(修改品德成绩:);scanf(%d,&studenti.pingde);break;case 0:printf(修改任课教师评分:);scanf(%d,&studenti.jiaoping);break;So

27、rtInfo(student);SaveStruct(student,sizeof(struct student_info),counter,student_info.dat);PM=0;getchar();printf(修改完成.);getchar();system(cls);/-4.删除学生信息-void DeleteInfo()int i,j,num;char YN;printf(请输入要删除的学生信息学号:);scanf(%d,&num);getchar();if(i=NumExist(student,num)=-1)printf(没有该学号,按回车键返回.);getchar();sy

28、stem(cls);return;ViewInfo(&studenti);printf(n确认删除(Y/N):);scanf(%c,&YN);getchar();if(YN!=Y & YN!=y)printf(删除取消.);elsefor(j=i;jcounter-1;j+)studentj=studentj+1;counter-;PM=0;SaveStruct(student,sizeof(struct student_info),counter,student_info.dat);SaveInt(&counter,sizeof(counter),counter,counter.dat);p

29、rintf(删除完成.);getchar();system(cls);/-平均分、综合分排名-void paiming1(struct student_info student)struct student_info *pN,*temp;int i,j;for(i=0;icounter;i+)pi=&studenti;for(i=0;icounter-1;i+)for(j=i+1;jave ave)temp=pi;pi=pj;pj=temp;for(i=0;ipaiming1=i+1;printf(平均分排名完成.n);/综合测评分排名void paiming2(struct student_

30、info student)struct student_info *pN,*temp;int i,j;for(i=0;icounter;i+)pi=&studenti;for(i=0;icounter-1;i+)for(j=i+1;jzhongping zhongping)temp=pi;pi=pj;pj=temp;for(i=0;ipaiming2=i+1;printf(综合测评分排名完成.n);/-6.浏览所有学生信息-void ViewAll()int i;for(i=0;inum);getchar();if(NumExist(student,sp-num)!=-1)printf(该学号

31、已存在,请重新输入.);getchar();system(cls);continue;break;printf(录入姓名:);gets(sp-name);printf(录入性别:);gets(sp-sex);printf(录入家庭住址:);gets(sp-adress);printf(录入联系电话:);gets(sp-tel);printf(n接下来录入成绩n);printf(语文:);scanf(%d,&sp-chinese);printf(数学:);scanf(%d,&sp-math);printf(英语:);scanf(%d,&sp-english);sp-ave=(sp-chinese+sp-math+sp-english)/3.0;printf(同学互评:);scanf(%d,&sp-huping);

展开阅读全文
相关资源
相关搜索
资源标签

当前位置:首页 > 技术资料 > 课程设计

版权声明:以上文章中所选用的图片及文字来源于网络以及用户投稿,由于未联系到知识产权人或未发现有关知识产权的登记,如有知识产权人并不愿意我们使用,如有侵权请立即联系:2622162128@qq.com ,我们立即下架或删除。

Copyright© 2022-2024 www.wodocx.com ,All Rights Reserved |陕ICP备19002583号-1 

陕公网安备 61072602000132号     违法和不良信息举报:0916-4228922