课程设计选题管理系统报告.doc_第1页
课程设计选题管理系统报告.doc_第2页
课程设计选题管理系统报告.doc_第3页
课程设计选题管理系统报告.doc_第4页
课程设计选题管理系统报告.doc_第5页
已阅读5页,还剩32页未读 继续免费阅读

下载本文档

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

文档简介

精品上 海 电 力 学 院课程设计报告面向对象程序设计(2014/2015学年第一学期) 课题名称 课程设计选题管理系统设计 院 (系) 电子与信息工程学院 专 业 通信工程 学 号 20132234 姓 名 储昊 时 间 2015年1月19日至1月23日 地 点 虚拟仿真实验室(南4教312) 指导老师 骆政屹 目 录一、设计目的与任务.21、本课程设计的目的.22、本课程设计的任务.2二、设计方案.31、总体设计.32、系统设计.33、系统实现.54、系统测试16三.心得体会.20一、设计目的与任务1、本课程设计的目的 1)课程设计是实践教学环节。设置课程设计的目的是加强学生对本课程及相关课程知识的理解,培养学生综合运用理论知识分析和解决实际问题的方法与能力。有助于提高学生的创新能力和创新意识。搞好课程设计教学工作,对实现专业培养目标,提高学生全面素质有重要作用。2)通过课程设计更进一步理解 C+的基础知识。3)训练用系统的观点及软件开发的一般规范进行软件开发,并在此过程中培养严谨的科学态度和良好的工作作风。初步掌握软件开发过程中的问题分析、系统设计、程序编码、调试、测试等方面的基本方法和技能。4) 熟练掌握 C+知识在程序中的应用,了解书本知识在解决实际问题中的用途。2、本课程设计的任务(1)问题描述课程设计题目包括:编号、名称、关键词、实现技术、人员数(由几个人来完成)等信息。学生信息包括:学号、姓名、性别、年龄、班级、专业等信息。(2)功能要求 添加功能:程序能够添加学生的记录和课程设计题目记录,提供选择界面供用户选择所要添加的类别。添加记录时,要求学号和编号要唯一。如果添加了重复记录,则提示数据添加重复并取消添加。 查询功能:可根据学号、姓名、编号、名称等信息对已添加的学生和课程设计题目进行查询,如果未找到,给出相应的提示信息,如果找到,则显示相应的记录信息。 显示功能:可显示当前系统中所有学生的信息和课程设计题目信息,每条记录占据一行。 编辑功能:可根据查询结果对相应的记录进行修改,修改时注意学号的唯一性。 删除功能:主要实现对已添加的学生和课程设计题目记录进行删除。如果当前系统中没有相应的记录,则提示“记录为空!”并返回操作。 统计功能:能根据多种参数进行统计。能按课程设计题目名称统计出学生选择该题目的人员的信息。 保存功能:可将当前系统中各类记录存入文件中,存入方式任意。 读取功能:可将保存在文件中的信息读入到当前系统中,供用户进行使用。二、 设计方案1、总体设计 我们设计一个程序对学生课程设计选题信息进行保存,对学生的选题信息进行可执行多种操作,该程序包括以下功能模块:1)学生信息添加模块:能够输入学生基本信息并保存到文件中。2)查询模块:显示所有符合要求的课程设计信息。3)编辑模块:可对学生信息进行修改。4)删除模块:可删除相应的学生信息。5)统计模块:能根据多种参数进行统计。6)查看模块:显示所有课程设计选题的信息。7)退出系统。为了完善系统,我们还添加了一个登录界面。2、系统设计1)类设计定义一个学生类Student,类中包括学号stuid,姓名stuname,性别sex,年龄age,班级clas,专业specialty,及所选课程的课程编号couid,课程名称 couname,关键词keyword,实现技术technology;定义一个管理类Guanli,其成员函数包括向文件输入函数void write(int n);从文件读取函数,int read();添加学生信息函数void add(),查询信息函数void search (),按学号查询函数void searchsid(),按姓名查询函数void searchsname(),按题目编号查询函数void searchcid(),按题目名称查询函数void searchcname();修改信息函数void alter() ;删除信息函数void del();统计信息函数void total();显示函数void display()以及一个数据成员Student stu50。2)函数设计void write(int n),向文件中写入数据,打开文本文档,并将数据输入到文本文档中;int read(),向文件中写入数据从文件中读数据,打开文本文档,并将文本文档中的数据输出;void add(),添加学生信息;void search()查询信息(可根据学生的学号、姓名、所选课程编号、课程名称进行信息查询);void alter(),修改学生信息;void del(),删除学生信息,根据输入的学生学号通过调用函数实现;void total(),统计学生信息(根据学生所选课程名称进行统计);void display(),显示函数用来显示所有学生信息;int main()主函数,显示主菜单,调用各个函数实现所有功能。 3)系统流程图课程设计学生选课系统设计结构图:进入功能界面后,可以进行多项功能选择,如添加、查询、显示、修改、删除、统计,将数据写入文件以及从文件读取数据等;而查询功能又可以分为按学号、姓名、题目编号、题目名称等方式进行查询。如下图所示。主菜单退出系统显示所有记录统计所有记录删除学生信息修改学生信息 查询记录信息添加新的记录按学号查询按姓名查询按编号查询按名称查询4)界面设计主界面是“欢迎使用课程设计选课系统”,下面是所要使用的功能:1. 添加新的纪录2. 查询记录信息3. 修改学生信息4. 删除学生信息5. 统计所有记录6. 显示所有记录0. 退出系统其中,查询记录又可以弹出一个界面分别有以下几个功能:1. 根据学号查询2. 根据姓名查询3. 根据编号查询4. 根据题目名称查询每实现一个功能,重新弹出主界面,进行下一个的功能选择。3、系统实现1)类实现class Studentpublic: int stuid; /学号 char stuname10; /姓名 char sex2; /性别int age; /年龄char clas10; /班级char specialty10; /专业 int couid; /题目编号 char couname10; /题目名称char keyword20; /关键词char technology30; /实现技术stu50; /定义对象class Guanliprivate:Student stu50;public:void add(); /添加学生信息void search(); /查询信息void searchsid(); /按学号查询信息void searchsname(); /按名字查询信息void searchcid(); /按题目编号查询信息void searchcname(); /按题目名称查询信息 void alter(); /修改信息void del(); /删除信息void total(); /统计信息void display(); /显示信息void write(int n); /向文件中写入数据int read(); /从文件中读数据;2)函数实现 void Guanli:write(int n) fstream myfile;myfile.open(student.txt,ios:out|ios:binary);if(!myfile)cout该文件不能打开!endl;abort();int count=n;myfilecountendlendl;for(int i=0;i=count;i+)myfilestui.stuid stui.stuname stui.sex stui.age stui.clas stui.specialty stui.couid stui.couname stui.keyword stui.technology endl;myfile.close();int Guanli:read() fstream myfile;myfile.open(student.txt,ios:in|ios:binary);if(!myfile)cout该文件不能打开!count;for(int i=0;istui.stuidstui.stunamestui.sexstui.agestui.classtui.specialtystui.couidstui.counamestui.keywordstui.technology;coutendl;myfile.close();return count;void Guanli:add()int n=read();int i=0;char sign;coutendl请输入增加的学生的相关信息: endl; while(sign!=N) loop:coutstui.stuid; cout endl;int c=0;while(ci)c+;if(stui.stuid=stui-c.stuid)cout你输入的学号已经存在!请重新输入endl;goto loop;coutstui.stuname; coutendl; coutstui.sex;coutendl;coutstui.age;coutendl;coutstui.clas; coutendl; coutstui.specialty;coutendl;coutstui.couid;coutendl;coutstui.couname; coutendl;coutstui.keyword;coutendl;coutstui.technology;coutendl;coutsign; /输入判断 i+;write(i);void Guanli:search()int n=read();cout* (1)根据学号查询 *endl; cout* (2)根据姓名查询 *endl; cout* (3)根据编号查询 *endl; cout* (4)根据名称查询 *endl;coutendl; int c;Guanli g; coutc; switch(c)case 1: g.searchsid(); break; case 2: g.searchsname(); break; case 3: g.searchcid(); break; case 4: g.searchcname(); break;default:cout输入错误,请重新输入!endl;g.write(n);void Guanli:searchsid() int n=read();int s; int i=0;coutendl查找学生信息:endl;cout请输入需要查找学生的学号:s; while(stui.stuid-s)!=0&in) i+; /查找判断 if(i=n) cout提示:对不起,无法找到该学生的信息!endl; elsecout*endl; cout学号: stui.stuidendl; cout姓名: stui. stunameendl; cout性别: stui.sexendl ; cout年龄: stui. ageendl; cout班级: stui.clas endl; cout专业: stui. specialtyendl; cout题目编号: stui.couidendl; cout题目名称: stui.counameendl; cout关键词: stui.keywordendl;cout实现技术: stui.technologyendl;void Guanli:searchsname() int n=read();char a10; cout请输入需要查找学生的姓名:a; for(int i=0;in;i+) if(strcmp(stui.stuname,a)=0) cout*endl;cout学号: stui.stuidendl; cout姓名: stui. stunameendl; cout性别: stui.sexendl ; cout年龄: stui. ageendl ; cout班级: stui.clasendl; cout专业: stui. specialtyendl; cout题目编号: stui.couidendl; cout题目名称: stui.counameendl;cout关键词: stui.keywordendl;cout实现技术: stui.technologyendl; void Guanli:searchcid()int n=read();int b; int i=0;cout请输入需要查找的题目编号:b; while(stui.couid-b)!=0&in) i+; /查找判断if(i=n) cout提示:对不起,无法找到该信息!endl; elsecout*endl; cout学号: stui.stuidendl; cout姓名: stui. stunameendl; cout性别: stui.sexendl ; cout年龄: stui. ageendl ; cout班级: stui.clas endl; cout专业: stui. specialtyendl; cout题目编号: stui.couidendl; cout题目名称: stui.counameendl; cout关键词: stui.keywordendl;cout实现技术: stui.technologyendl;void Guanli:searchcname()int n=read();char c10; cout请输入需要查找的题目名称:c;for(int i=0;in;i+) if(strcmp(stui.couname,c)=0) cout*endl; cout学号: stui.stuidendl; cout姓名: stui. stunameendl; cout性别: stui.sexendl ; cout年龄: stui. ageendl ; cout班级: stui.clas endl; cout专业: stui. specialtyendl; cout题目编号: stui.couidendl; cout题目名称: stui.counameendl; cout关键词: stui.keywordendl;cout实现技术: stui.technologyendl; void Guanli:alter() int n=read();int s; int i=0;coutendl修改学生信息:endl;cout请输入需要修改学生的学号:s; while(stui.stuid-s)!=0&in) i+; /查找判断 if(i=n) cout提示:对不起,无该学生的信息!endl; /输入失败信息 elsecout该学生的信息:endl; cout学号stui.stuidn姓名stui.stunamen性别stui.sexn年龄stui.agen班级stui.clasn专业stui.specialtyn题目编号stui.couidn题目名称stui.counamen关键词stui.keywordn实现技术stui.technologynendl;cout请重新输入该学生的信息endl;coutstui. stuid ; coutendl; coutstui. stuname; coutendl; coutstui.sex; coutendl; coutstui.age; coutendl; coutstui.clas ; coutendl; coutstui. specialty; coutendl; coutstui.couid; coutendl; coutstui.couname; coutendl;coutstui.keyword; coutendl; coutstui.technology; coutendl; char c; cout是否保存数据?(y/n)c; if(c=y)cout修改成功!endl;write(n);void Guanli:del() int n=read();int s; int i=0,j;coutendl删除学生信息:endl;cout请输入需要删除学生的学号:s; while(stui.stuid-s)!=0&in) i+; /查找判断 if(i=n) cout提示:记录为空!endl; /返回失败信息 elsefor(j=i;jn-1;j+) /删除操作 stuj.stuid=stuj+1.stuid; strcpy(stuj.stuname,stuj+1.stuname); strcpy(stuj.sex,stuj+1.sex);stuj.age=stuj+1.age;strcpy(stuj.clas,stuj+1.clas); strcpy(stuj.specialty,stuj+1.specialty); stuj.couid=stuj+1.couid; strcpy(stuj.couname,stuj+1.couname); strcpy(stuj.keyword,stuj+1.keyword); strcpy(stuj.technology,stuj+1.technology); cout提示:已成功删除!endl; /返回成功信息 cout你要删除的信息如下:endl; cout姓名:stui.stunameendl;cout学号:stui.stuidendl; cout性别:stui.sexendl;cout年龄:stui.ageendl; cout班级:stui.clasendl;cout专业:stui.specialtyendl; cout题目编号:stui.couidendl; cout题目名称:stui.counameendl;cout关键词:stui.keywordendl; cout实现技术:stui.technologyendl; write(n-1); void Guanli:total()int n=read();char c10; cout请输入需要查找的题目名称:c;for(int i=0;in;i+) if(strcmp(stui.couname,c)=0) cout你要统计的信息如下:endl;cout姓名:stui.stunameendl;cout学号:stui.stuidendl;cout性别:stui.sexendl;cout年龄:stui.ageendl;cout班级:stui.clasendl;cout专业:stui.specialtyendl;cout题目编号:stui.couidendl;cout题目名称:stui.counameendl;cout关键词:stui.keywordendl;cout实现技术:stui.technologyendl; elsecout没有此条记录!endl;void Guanli:display() int n=read(); coutendl显示全部学生信息:endl;if(!stu)cout没有记录endl; elsefor(int i=0;in;i+) /循环输入 cout学号stui.stuidn姓名stui.stunamen性别stui.sexn年龄stui.agen班级stui.clasn专业stui.specialtyn题目编号stui.couidn题目名称stui.counamen关键词stui.keywordn实现技术stui.technologynendl; 3)主函数实现int main()char choice;coutnnt *欢迎使用课程设计选题管理系统*nn; coutt 1.*添加新的记录*n; coutt 2.*查询记录信息*n; coutt 3.*修改学生信息*n; coutt 4.*删除学生信息*n; coutt 5.*统计所有记录*n; coutt 6.*显示所有记录*n; coutt 0.* 退出系统 *n;coutchoice; Guanli g;if(choice=0)coutntt 谢谢您使用本系统!nnendl;exit(0);else if(choice=1) g.add();system(pause);main();else if(choice=2)g.search();system(pause);main();else if(choice=3) g.alter(

温馨提示

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

评论

0/150

提交评论