收藏 分销(赏)

C学生成绩标准管理系统专业课程设计方案报告.doc

上传人:精*** 文档编号:2727090 上传时间:2024-06-05 格式:DOC 页数:25 大小:80.04KB
下载 相关 举报
C学生成绩标准管理系统专业课程设计方案报告.doc_第1页
第1页 / 共25页
C学生成绩标准管理系统专业课程设计方案报告.doc_第2页
第2页 / 共25页
C学生成绩标准管理系统专业课程设计方案报告.doc_第3页
第3页 / 共25页
C学生成绩标准管理系统专业课程设计方案报告.doc_第4页
第4页 / 共25页
C学生成绩标准管理系统专业课程设计方案报告.doc_第5页
第5页 / 共25页
点击查看更多>>
资源描述

1、一目标和要求经过本课程设计实践,全方面总结C+课程学习中数据类型、程序结构、数组、函数、指针、结构体、链表等基础概念,掌握其使用方法。掌握面向对象程序设计中相关类、对象、继承、重载、多态性、输入输出流类体系、文件操作基础概念,初步学会用类和对象这种面向对象程序设计方法编写应用程序。培养使用面向对象程序设计方法编写计算机程序能力。经过设计一个学生成绩统计管理,深入熟悉C+中类概念、类封装、继承实现方法。了解系统开发需求分析、类层次设计、模块分解、编码测试、模块组装和整体调试全过程,加深对C+了解和Visual C+环境使用;逐步熟悉程序设计方法,并养成良好编程习惯。程序设计是一门实践性很强课程,

2、必需十分重视实践步骤。很多实际知识不是靠听课和看书学到,而是经过长时间实践积累。一、 设计内容学生成绩管理系统1 基础功效: 这个程序关键功效是输入学生姓名、成绩,学号,并能够对学生成绩按学号进行查询。该系统含有存贮学生数据,按学号按需要修改学生成绩,列出学生成绩和统计功效。2 扩展功效:学生数据添加、修改、和删除2.ER修改数据删除数据查询数据显示数据平均数据添加数据学生成绩管理系统 二、 过程和结果关键内容以下:1. 关键类设计,继承层次关系,代码:首先,创建了一个student类. Student类申明以下:class Studentpublic:int Class,num;char n

3、ame8;float cpp,math,eng,ave;int order;Student *next;public:Student() Student(int c1,int n1,char*n,float e1,float c2,float m,float e2,float s,float p,float a,int o,Student *next=NULL)Class=c1;num=n1;strcpy(name,n);cpp=c2;math=m;eng=e2;ave=a;order=o;this-next=next; 关键功效函数设计:1. 创建学生数据,对学生成绩录入。代码:friend

4、 Student *Create(Student *head,istream& in)int y;Student *p;int Class,num;char name8;float cpp,math,eng;if(&in=&cin)/coutnn请输入学生数据(输入成绩非法,则结束),数据输入格式为:n/Classnamenumcppmatheng;/coutnn请输入学生数据:ncout班级:Class; cout姓名:name;cout学号:num;coutC+成绩:cpp;cout数学成绩:math;cout英语成绩 :eng;/*while(Valid(elec)&Valid(cpp)

5、&Valid(math)&Valid(eng)&Valid(sport)&Valid(polity)*/p=new Student;p-Class=Class;p-num=num;strcpy(p-name,name);p-cpp=cpp;p-math=math;p-eng=eng;p-ave=(cpp+math+eng)/6;head=Insert(head,p);/inClassnamenumeleccppmathengpolitysport;couttt*继续添加请按1*n;couty; if(y=2) ShowMenu(); elsehead=Create(head,cin);SetO

6、rder(head); /设置排名return head;2. 此函数为查找函数实现过程 关键代码:friend const Student * Lookup(const Student *head,int num) /查找指定学号为num结点 while(head & head-num!=num)head=head-next;return head;friend void OutputOne(const Student* head) /输出一个学生数据coutClasstnametnumtcpptmathtengtordernum!=num)p1=p2,p2=p2-next;if(p2)if

7、(p2=p1)head=head-next;delete p1;else p1-next=p2-next;delete p2;cout已删除num号学生数据n;SetOrder(head);else coutorder=order+;head=head-next;5修改学生信息friend Student *Modify(Student *head,int num) /修改学号为学生数据Student *p1=head,*p2=p1;while(p2&p2-num!=num) /寻求待修改结点p1=p2,p2=p2-next;if(p2) /修改指定结点数据/*coutnn请输入新数据,格式为

8、:np2-Classp2-namep2-nump2-cppp2-mathp2-eng;*/ cout班级:p2-Class; cout姓名:p2-name;cout学号:p2-num;coutC+成绩:p2-cpp;cout数学成绩:p2-math;cout英语成绩 :p2-eng;while(!Valid(p2-cpp)|!Valid(p2-math)|!Valid(p2-eng)coutnn成绩数据非法!请重新输入,格式为:np2-Classp2-namep2-nump2-cppp2-mathp2-eng;p2-ave=(p2-cpp+p2-math+p2-eng)/3;/将修改指定结点从

9、原链表上修改下来,并重新降序插入原链表if(p2=p1)head=Insert(p2-next,p2);elsep1-next=p2-next; head=Insert(head,p2);SetOrder(head);else cout没找到指定学生!n;return head;6.显示数据:friend void OutputAll(const Student*head) /输出全部学生数据if(!head) coutnntt没有任何学生数据!nn; return;coutnntt学生成绩表nn;coutnext;7.平均数据函数friend void Statistic(const Stu

10、dent *head)int i=0;float ave_cpp=0,ave_math=0,ave_eng=0;while(head)ave_cpp+=head-cpp;ave_math+=head-math;ave_eng+=head-eng;i+;head=head-next;if(!i)coutnn没有任何学生数据!n;return;coutnntt各门课程平均成绩表nn;couttC+t数学t英语n;coutave_cpp/itave_math/itave_eng/iendl;程序测试结果:1运行程序.会出现以下画面,根据提醒进行选择.2. 首先选择1,然后按Enter键.根据提醒对学

11、生情况进行输入.图:3. 按1键能够添加多个学生成绩数据,按2返回主界面。4. 选择5, 然后按Enter键,显示刚才输入数据和排名情况。5在主界面选择2能够修改学生数据。6.在主界面选择3能够按学号查询学生成绩情况7. 在主界面选择7能够按学号删除学生成绩信息 三、 设计总结这次课程设计基础上涵盖了学习到C+ 语言知识点,课程设计题目要求不仅要求对书本即使是网上搜来代码,但这些代码没措施运行,我把这些代码改了和增加了自己写代码,最终能够运行,而且抵达自己想要结果,这次课程设计不仅让我修补了以前学习漏洞,也让我知道一个道理:编程需要爱好和实际动手。C+语言程序设计课程设计,我从中受益匪浅,而且

12、对C+语言程序设计这一门课程有了更深一步认识。附件程序源代码清单:#include #include class Studentpublic:int Class,num;char name8;float cpp,math,eng,ave;int order;Student *next;public:Student() Student(int c1,int n1,char*n,float e1,float c2,float m,float e2,float s,float p,float a,int o,Student *next=NULL)Class=c1;num=n1;strcpy(name

13、,n);cpp=c2;math=m;eng=e2;ave=a;order=o;this-next=next; friend int Valid(float score) return (score100) ?0:1;friend void SetOrder(Student*head) int order=1;while(head)head-order=order+;head=head-next;friend Student* Insert(Student *head,Student *p) /在head所指链表中降序插入结点p Student*p1,*p2;if(head=0)head=p;p

14、-next=0;else if(head-aveave)p-next=head;head=p;elsep2=p1=head;while(p2-next&p2-avep-ave)p1=p2;p2=p2-next;if(p2-avep-ave)p2-next=p;p-next=0;else p-next=p2;p1-next=p;return head;friend Student *Create(Student *head,istream& in)int y;Student *p;int Class,num;char name8;float cpp,math,eng;if(&in=&cin)/c

15、outnn请输入学生数据(输入成绩非法,则结束),数据输入格式为:n/Classnamenumcppmatheng;/coutnn请输入学生数据:ncout班级:Class; cout姓名:name;cout学号:num;coutC+成绩:cpp;cout数学成绩:math;cout英语成绩 :eng;/*while(Valid(elec)&Valid(cpp)&Valid(math)&Valid(eng)&Valid(sport)&Valid(polity)*/p=new Student;p-Class=Class;p-num=num;strcpy(p-name,name);p-cpp=cp

16、p;p-math=math;p-eng=eng;p-ave=(cpp+math+eng)/6;head=Insert(head,p);/inClassnamenumeleccppmathengpolitysport;couttt*继续添加请按1*n;couty; if(y=2) ShowMenu(); elsehead=Create(head,cin);SetOrder(head); /设置排名return head;friend const Student * Lookup(const Student *head,int num) /查找指定学号为num结点 while(head & hea

17、d-num!=num)head=head-next;return head;friend void OutputOne(const Student* head) /输出一个学生数据coutClasstnametnumtcpptmathtengtorderendl;friend void OutputAll(const Student*head) /输出全部学生数据if(!head) coutnntt没有任何学生数据!nn; return;coutnntt学生成绩表nn;coutnext;friend Student *Modify(Student *head,int num) /修改学号为学生

18、数据Student *p1=head,*p2=p1;while(p2&p2-num!=num) /寻求待修改结点p1=p2,p2=p2-next;if(p2) /修改指定结点数据/*coutnn请输入新数据,格式为:np2-Classp2-namep2-nump2-cppp2-mathp2-eng;*/ cout班级:p2-Class; cout姓名:p2-name;cout学号:p2-num;coutC+成绩:p2-cpp;cout数学成绩:p2-math;cout英语成绩 :p2-eng;while(!Valid(p2-cpp)|!Valid(p2-math)|!Valid(p2-eng)

19、coutnn成绩数据非法!请重新输入,格式为:np2-Classp2-namep2-nump2-cppp2-mathp2-eng;p2-ave=(p2-cpp+p2-math+p2-eng)/3;/将修改指定结点从原链表上修改下来,并重新降序插入原链表if(p2=p1)head=Insert(p2-next,p2);elsep1-next=p2-next; head=Insert(head,p2);SetOrder(head);else coutnum!=num)p1=p2,p2=p2-next;if(p2)if(p2=p1)head=head-next;delete p1;else p1-n

20、ext=p2-next;delete p2;cout已删除num号学生数据n;SetOrder(head);else coutcpp;ave_math+=head-math;ave_eng+=head-eng;i+;head=head-next;if(!i)coutnn没有任何学生数据!n;return;coutnntt各门课程平均成绩表nn;couttC+t数学t英语n;coutave_cpp/itave_math/itave_eng/inext;delete p;friend void ShowMenu(void)coutnn;couttt*欢迎使用学生成绩管理系统*ntt* *ntt*

21、1.从键盘录入和添加数据 *n/tt* 2.从文件录入和添加数据 *ntt* 2.修改数据 *ntt* 3.查询数据 *ntt* 4.删除数据 *ntt* 5.显示数据 *ntt* 6.平均数据 *n/tt* 7.保留数据 *ntt* *ntt* 0.退出系统 *ntt*nn;void main (void) Student *head=0;int select;while(1)ShowMenu();coutselect;switch(select)case 0:DeleteChain(head);coutnn谢谢您使用本系统!nn;return;case 1:head=Create(head

22、,cin);break;/*case 2:char fname256;cout请输入文件名:;cin.get();cin.getline(fname,256);ifstream in(fname);if(!in)coutn不能打开fname文件!n;break;head=Create(head,in);break;*/case 2:int num;coutnum;head=Modify(head,num);break;case 3:int num;coutnum;const Student *t=Lookup(head,num);if(t)coutttttname同学成绩表n;cout班级t姓

23、名t学号tC+t数学t英语t名次n;OutputOne(t);else cout没有找到指定学生!n;break;case 4:int num;coutnum;head=DeleteStudent(head,num);break;case 5:OutputAll(head);break;case 6:Statistic(head);break;/*case 7:if(head)char fname256;cout请输入文件名:;cin.get();cin.getline(fname,256);SaveAll(head,fname);else coutnn尚无数据可保留!nn;break;*/default:coutnn非法操作!nn;

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 学术论文 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服