版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、C+面向对象程序设计综合项目报告项目名称: 学生毕业设计管理系统 专 业: 软件技术 班 级: 软件0921 项目成员: 毛亚明 陈晓琴 王雪亮 报告日期:2010年12月29设计任务 一、基本要求(1)要求学生达到熟练掌握C+语言的基本知识和技能; (2)基本掌握面向对象程序设计的基本思路和方法; (3)能够利用所学的基本知识和技能,解决简单的面向对象程序设计问题。(4)要求利用面向对象的方法以及C+的编程思想来完成系统的设计;(5)要求在设计的过程中,建立清晰的类层次; (6)在系统中至少要定义三个类,每个类中要有各自的属性和方法;二、创新要求: 在基本要求达到后,可进行创新设计,如根据查
2、找结果进行修改的功能及设计出比较友好的界面等。 三、设计方法和基本原理: 1、问题描述(功能要求): 某学校,主要有四类学生:专科生、本科生、硕士研究生和博士研究生.现在,需要存储这些学生的编号、姓名、年级和班级、级别、论文题目、指导老师和成绩,并显示全部信息。 要求: 1)其中,学生编号在生成学生信息时同时生成,每输入一个学生信息编号顺序加1. 2)程序对所有学生都有提升级别的功能 3)能按姓名或者编号显示、查找、增加、删除和保存各类学生的信息 2、问题的解决方案: 根据系统功能要求,可以将问题解决分为以下步骤: (1)分析系统中的各个实体之间的关系及其属性和行为; (2)根据问题描述,设计
3、系统的类层次; (3)完成类层次中各个类的描述(包括属性和方法); (4)完成类中各个成员函数的定义; (5)完成系统的应用模块; (6)功能调试; (7)完成系统总结报告以及系统使用说明书. 四、程序设计和调试: ; 以对话框的形式,展现程序的实现。1、设计思路: 根据对学生信息的增删改查,为四个基本的模块,然后展开,运用文件流的方法,实现数据的保存。在原有基础上增加4个基本模块的一些功能,如以不同形式查看学生的信息.系统功能模块图类的层次图学生类学生信息结构体姓名学位学号调试过程-Configuration: Test Win32 Debug-Compiling.。Test.cppH:C+
4、项目学生毕业设计管理系统Test。cpp(50) : error C2039: next' : is not a member of student H:C+项目学生毕业设计管理系统Test。cpp(23) : see declaration of 'student'H:C+项目学生毕业设计管理系统Test。cpp(159) : error C2039: next' : is not a member of student H:C+项目学生毕业设计管理系统Test。cpp(23) : see declaration of studentH:C+项目学生毕业设计管
5、理系统Test.cpp(159) : fatal error C1903: unable to recover from previous error(s); stopping compilation执行 cl。exe 时出错.Test.obj 1 error(s), 0 warning(s)程序代码#include iostream#include string#include<cmath#includefstream #includeiomanipusing namespace std;int amount=0;int num=100; /当前最高学号 ofstream *file5
6、0;struct info /学生信息结构体 string xy; string zy; string bj; string teacher; string lw; string score; struct info next;;class student /学生数据类 public: int id; string mun; string name; info sc3; class student next; ;void input(student head); /录入 /函数声明/void search1(student head); /姓名查询void search2(student he
7、ad); /学号查询void change(student head); /修改void shanchu(student head); /删除void get(student *head); /取数据void display(); /显示菜单void show(student head); /显示数据void readin(student head); /保存数据string int_char(int);void main() /主函数 system("color f0”); char x; bool flag2=0; student head=new student; /初始化学生
8、数据 head>next=NULL; cout” ”endl; cout<” 学生毕业管理设计系统 ”<endl; cout<” =-=-=-= ”<endl; cout<" 软件0921 _!! ”<<endl; cout<<" ”<endl; cout<” "endl; cout” 作者: 王雪亮 毛亚明 陈晓琴 ”<endl; cout<" ”<<endl; display(); /显示菜单 do do cin>x; if(x>=0'
9、&x=8) flag2=1; else cout"指令错误!!!!!"<endl; cout" 请选择相应的数字进行操作: ”; while(flag2=0); switch(x) case 1':cout”*现在进行学生信息录入*n”; input(head); cout<”输入的学生信息为:n”; show(head); coutendl; display(); break; case 2': char z; cout”*现在进行学生信息查询*n”; cout<”请选择查询方式:”; cout"(0)。姓名查
10、询;(1).学号查询:”; cin>z; while(z!='0'&z!='1) cout"指令错误请选择(0)或者(1)!!!”<<endl; cout<”请选择查询方式:(0)。姓名查询;(1)。学号查询:" cinz; switch(z) case 0: search1(head);break;/按姓名查询 case 1: search2(head);break;/按学号查询 cout<endl; display(); break; case 3: cout<”*现在进行学生信息修改*n”; chan
11、ge(head); cout<endl; display(); break; /按姓名修改 case 4: cout<”*现在进行学生信息删除*n”; shanchu(head); show(head); cout<endl; display(); break; /删除 case 5: cout"*现在进行显示学生信息*n”; show(head); coutendl; display(); break; /显示数据 case '6:cout<”*现在进行提取学生信息*n”; get(head); cout<endl; display(); br
12、eak; case 7':cout”*现在进行保存学生信息*n"; readin(head); cout<endl; display(); break; case 8: cout<endl; cout<” 您已退出学生信息管理系统, 谢谢您的使用! n"; coutendl; exit(0); break; while(flag2=1);void display() /显示菜单 cout”请选择你需要的项目: n”; cout<” 1录入; 2查询; n”; cout<<" 3修改; 4-删除; n”; cout<
13、<" 5-显示; 6-提取; n”; cout” 7-保存; 8退出; n”; cout" 请选择你需要的数字进行操作: ”;void show(student *head) /显示学生数据 student *stu=head; cout<” 学号 | 学位 姓名 学院 | 专业 班级 | 导师 论文 成绩 ”endl; while(stu>next!=NULL) stu=stunext; cout<"| ”<setw(9)<(stu)。id; cout<" ”setw(4)<(stu).mun; cout
14、<" | "<setw(6)<<(*stu)。name; cout” ”setw(4)(stu)。sc3。xy; cout<” "setw(4)(stu).sc3.zy; cout<<" ”setw(4)<(stu)。sc3。bj; cout<” | ”<setw(4)(stu)。sc3。teacher; cout<<” ”<setw(4)(stu).sc3.lw; cout” ”<<setw(4)(*stu)。sc3。score; cout<"|&
15、quot;endl; void readin(student *head) /保存学生数据 char a; student stu=head-next; cout<"现在保存输入学生数据,是否继续操作?(y/n)”; cina; ofstream outfile("D:课设学生信息。txt”,ios::out); if(! outfile) cout”打开文件错误!!!n”; exit(0); while(a!=n') while(stu!=NULL) outfile<"*第”amount<"个学生的数据:*n"; o
16、utfilecout<"| 学号 | 学位 姓名 学院 专业 班级 导师 论文 |成绩"<endl; outfile" 学生信息: n” <" "setw(9)<(stu)。id<” ”<setw(4)<(stu)。mun<" | ”<setw(6)<(*stu).name<” ”setw(4)< (*stu)。sc3。xy< ” ”setw(4)<(stu)。sc3.zy<<” | ”<setw(4)<(stu)。sc3.bj
17、<” ”setw(4)<<(stu)。sc3。teacher " ”<setw(4)(*stu)。sc3。lw<" ”setw(4)(stu).sc3。score<endl; amount+; num+; (*stu).id=num; stu=stunext; break; cout<<"。.。成功将学生数据保存到学生信息。txt中! " outfile.close(); void input(student *head) /录入学生数据 char c; int j=0; student p=head; f
18、ilej=new ofstream(”D:课设学生信息.txt",ios:app); do student stu=new student; (stu)。id=num+1; num+; cout”请输入学位(专科生,本科生,硕士研究生,博士研究生):”setw(9); cin>(stu)。mun; cout<"请输入姓名:”<setw(20); cin(stu)。name; cout<"请输入该生所在学院:”setw(20); cin>(stu)。sc3。xy; cout”请输入该生所在专业:"<setw(20); c
19、in>(stu)。sc3.zy; cout<"请输入该生所在班级:”<setw(20); cin>(stu).sc3.bj; cout<"请输入该生导师姓名:”<setw(20); cin>>(stu)。sc3。teacher; cout"请输入该生论文标题:"setw(20); cin(stu)。sc3。lw; cout”请输入该生加权成绩:”setw(20); cin(stu).sc3。score; stu-next=pnext; pnext=stu; amount+; cout”数据录入成功,想继续录
20、入吗(y/n)”; cin>c; p=pnext; while(c!='y&c!='n) cout”指令错误请输入y/n!!!!”<endl; cout<”数据录入成功,想继续录入吗(y/n)"; cinc; while(c=y); j+; cout”输入了 "<amount<"个学生的信息.”endl; void search1(student head) /使用姓名查询学生数据 char c; string name; do student stu=headnext; bool flag=0; cout&l
21、t;”请输入你要查询的学生姓名:”; cinname; do if(stu!=NULL&name=(stu).name) /输出总成绩 flag=1; cout<”您要查询的学生是:"<stu-nameendl; cout<" 学号 学位 姓名 学院 | 专业 | 班级 导师 | 论文 成绩 ”endl; cout"| "<setw(9)(stu).id; cout"| ”<setw(4)<(*stu)。mun; cout<” "setw(6)(stu).name; cout” | ”
22、<setw(4)(*stu).sc3。xy; cout” ”<setw(4)(*stu).sc3。zy; cout” ”<setw(4)<(stu).sc3。bj; cout” "setw(4)(stu).sc3。teacher; cout” ”setw(4)(*stu)。sc3。lw; cout<” | ”<setw(4)<(stu)。sc3。score; cout<” "<endl; stu=stu-next; while(stu!=NULL); if(flag=0) cout<<"对不起!您要
23、查询的学生不存在!!!”<endl; cout<<”您想继续查询吗?(y/n)”; cinc; while(c!=y'&c!=n') cout<<"指令错误<请输入y/n!!!!!”<endl; cout”您想继续查询吗?(y/n)”; cin>>c; while(c='y); void search2(student *head)/用学号查询学生数据 char c;int no; do student stu=head->next; int flag=0; cout<"请输入
24、你要查询的学生学号:" cinno; do if(stu!=NULLno=(stu)。id) flag=1; cout<”您要查询的学生是:"stu>nameendl; cout<”| 学号 学位 姓名 学院 | 专业 班级 | 导师 论文 成绩 ”endl; cout<” ”<setw(9)<<(stu).id; cout" "<<setw(4)<<(stu)。mun; cout<” ”<<setw(6)(*stu)。name; cout" ”setw(4)(
25、stu).sc3。xy; cout<<" ”setw(4)<<(stu)。sc3。zy; cout” ”<setw(4)<<(stu)。sc3。bj; cout<<" | "setw(4)<(stu)。sc3.teacher; cout” "<setw(4)(stu)。sc3。lw; cout” | ”<setw(4)<<(*stu).sc3.score; cout”"endl; stu=stu>next; while(stu!=NULL); if(fla
26、g=0) cout<”对不起!您要查询的学生不存在!!!!"endl; cout”您想继续查询吗?(y/n)"; cin>c; while(c!=yc!=n) cout<”指令错误请输入y/n!>!!!"endl; cout<”您想继续查询吗?(y/n)"<endl; cinc; while(c=y); void change(student head) /修改学生数据 string name; char c; do bool flag2=0; student *stu=head ; info sc3; string
27、mu; cout”请输入您要修改的学生的姓名:”; cinname; do if(name=(stu)。name) flag2=1; cout”请输入新学位信息:"; cin>mu; cout”请输入新学院信息:”; cin>>sc3。xy; cout"请输入新专业信息:"; cin>sc3。zy; cout<”请输入新班级信息:" cinsc3。bj; cout<"请输入新导师信息:”; cin>>sc3.teacher; cout<"请输入新论文信息:”; cinsc3.lw;
28、 cout”请输入新加权成绩信息:”; cinsc3。score; (*stu).mun=mu; (stu)。sc3。xy=sc3。xy; (*stu)。sc3。zy=sc3。zy; (stu)。sc3。bj=sc3.bj; (stu)。sc3。teacher=sc3.teacher; (*stu).sc3。lw=sc3。lw; (*stu)。sc3。score=sc3。score; cout”| 学号 学位 姓名 学院 专业 班级 | 导师 论文 | 成绩 | ”<endl; cout<<” ”<setw(9)(stu)。id; cout” "setw(4)
29、(stu)。mun; cout<” ”<setw(6)(stu)。name; cout<” ”<setw(4)<(stu)。sc3。xy; cout<” | ”<setw(4)(*stu)。sc3.zy; cout” | ”setw(4)<<(stu).sc3。bj; cout<" ”setw(4)<(stu)。sc3。teacher; cout<" | ”setw(4)(*stu)。sc3.lw; cout<" ”setw(4)(stu)。sc3。score; cout<&quo
30、t;|"<endl; cout<”.。.。.数据修改成功!n" break; stu=stu->next; while(stu!=NULL); if(flag2=0) cout<”对不起!您要修改的学生不存在!请检查重新输入!!!!!!”endl; cout<”想继续修改吗?(y/n)”; cin>c; if(c!='y&c!=n) cout<”指令错误!请重新输入<y/n!!”; cin>c; while(c=y); void shanchu(student *head)/删除学生数据 char c;i
31、nt no; do int flag=0; cout<"请输入你要删除的学生学号:”; cinno; student q,*p; q=head; while(q-next!=NULL&qnext->id!=no) q=q-next; if(q-next!=NULL) flag=1; p=qnext; q>next=qnext>next; amount; free(p); cout<”。.。成功删除! " if(flag=0) cout<”对不起!您要删除的学生不存在!!!!!"endl; cout<”您想继续删除吗
32、?(y/n)”; cinc; while(c!=yc!='n') cout<<"指令错误请输入y/n!>!!!"<endl; cout<"您想继续删除吗?(y/n)”; cinc; while(c=y'); void get(student head) /提取学生数据 student *p; p=head; int j=0; string no; cout”请输入您想提取的学号前3位:”; cin>>no; string aa; aa=int_char(p-nextid); while(pnext!
33、=NULL) if(no=aa。substr(0,7) cout<”管理系统有您要提取的信息!”<<endl; j=1; else p=p-next; if(j=1) break; if(j=1) int c,m=0; string b,b1,e,infoma6=”xueyuan",”zhuanye”,”banji”,”daoshi”,”lunwen",”jiaquan" string kemu6="学院",”专业”,”班级”,"导师”,”论文",”加权"; cout”输入您想提取的信息代码:”e
34、ndl; cout<"1-学院 2->专业 3-班级”<<endl; cout”4-导师 5->论文 6-加权”<endl; cout<”选择:”; cin>>c; string cla=”class”; e=no.substr(6,1); b1=cla+e; b=b1+infomac-1; char f=new char20; for(int i=0;i20;i+) fi=bi; f=strcat(f,”.txt”); ofstream outfile(f,ios::out); if(! outfile) cout<&qu
35、ot;打开错误!!!!!”<endl; exit(1); outfile"t您要提取的信息ttt”<endl; outfile<" -"<endl; outfile<” 学号 | 姓名 | "; outfile<kemuc1” |”<endl; while(p>next!=NULL) outfile<" -”endl; outfile"|”<setw(11)<p>next-id<<” ”<setw(6)p>nextname<” ”; switch(c) case 1:outfile<setw(5)pnextsc3。xy” "; outfile<endl; break; case 2:outfile<<setw(5)<p-nextsc3。zy" ”; outfile<en
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 医疗器械经营企业追溯管理规范培训试题及答案
- 中心静脉导管护理规范全流程系统化管理指南
- 第9课 中世纪城市和大学的兴起 导学案 (含答案)2025-2026学年历史人教部编版九年级上册
- 2025《窦娥冤》悲剧成因课件
- 小学课外活动场所安全工作职责培训
- 2026广东安全员C2证土建类考试题库含新版试题解析、考试技巧和模拟考试助力专职安全生产管理人员备考
- 设备使用制度培训
- 2026年广东茂名幼儿师范专科学校单招职业倾向性测试题库含答案详解(预热题)
- 2025《林教头风雪山神庙》反抗的无奈与悲壮课件
- 2026年广西制造工程职业技术学院单招职业技能考试题库带答案详解(突破训练)
- DB11T 1204-2015 城市道路路面尘土残存量检测方法
- 2023年国网青海电力公司招聘考试真题
- 环氧丙烷课程设计
- 《电工与电子技术基础(第四版)》 课件 第一章 直流电路
- 2024双方自愿离婚协议参考样式
- 电力配网工程各种材料重量表总
- 部编人教版小学五年级语文上册《月迹》
- 纳米金的制备与性能
- 眼科视光规培出科小结
- 园林制图(高职)全套教学课件
- 施工方案 外墙真石漆(翻新施工)
评论
0/150
提交评论