C++教师信息管理系统_第1页
C++教师信息管理系统_第2页
C++教师信息管理系统_第3页
C++教师信息管理系统_第4页
C++教师信息管理系统_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

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

文档简介

1 一 一 课程设计问题描述课程设计问题描述 学院教学信息管理系统是高等学校教务管理的重要组成部分 其内容较多 为了简化计论 要求设计的管理系统能够完成以下功能 1 输入 输入每一位教师记录 将其信息写入文件中 2 显示 显示每位教师记录 3 排序 按职工号或教学效果综合评分进行排序 并显示 4 查找 完成按姓名或课程查找教师的相关记录 并显示 5 创建 创建新的纪录 输入数位教师记录 显示在屏幕上并保存 二 二 课程设计目的和要求 课程设计目的和要求 经过一个学期的 C 面向对象实用教程 课程的学习 已经有了一定地程 序设计基础 但是要学好 C 程序设计 不仅要认真阅读课本知识和从事课堂 学习 更重要的是要进行上机实践 通过上机实践才能增强和巩固知识 三 三 系统设计 算法分析 系统设计 算法分析 1 整体结构整体结构 整个程序定义四个类 1 CPerson 类 包含数据成员 name age sex 记录姓名 年龄 性别这 些信息 并包含构造函数及其他成员函数 定义 CPerson 类以后若有需 要 可再通过继承派生其他类 2 CTeacher 共有继承 CPerson 类 包含数据成员 title teano course score 分别记录职称 职工号 3 门课程和教学效 果综合评分等信息 另有其他成员函数 3 CNode 类 节点类 包含 2 个数据成员 CTeacher 类对象 p 和 CNode 类 指针对象 next 作为构建链表的单位 4 CList 类 链表类 声明为 CNode 类的友元类 数据成员有头结点 head 尾节点 tail 记录当前节点的 p 和当前节点前一节点的 pre 链表 相关的输入 显示 排序 查找 创建全部设为成员函数 总体流程为先打开文件 读取文件中的记录来创建链表 然后对链表进行操作 最后保存至文件中 2 2 流程图流程图 是 否 是 否 开始 打开文件 读取记录 输入 choice choice 0 显示当前记录 添加记录 创建新纪录 排序 查找 保存 保存 结束 3 3 各函数的功能和实现各函数的功能和实现 学院教学信息管理系统的相关功能由对应的函数来实现 1 输入教师信息并显示 void Append 通过提示一步步输入信息 由程序构建新节点并加入链表 2 显示所有记录 void Print 3 按职工号或教学效果综合评分排序并显示 int SortMenu void SortMenuControl void InsertByTeano CNode newp void SortByTeano void InsertByScore CNode newp void SortByScore 4 按姓名或课程查找教师记录并显示 int SearchMenu void SearchMenuControl void SearchByName void SearchByCourse 四 程序源代码四 程序源代码 include stdafx h include include include include include include using namespace std class CPerson private 4 string name int age char sex public CPerson CPerson string name int age 0 char sex M this name name this age age this sex sex void SetAge int age 0 this age age void SetNameAndSex string name char sex this name name this sex sex void ShowInfo cout name t age t sex M 男 女 endl string GetName return name int GetAge return age char GetSex return sex 5 class CTeacher public CPerson private string title 职称 string teano 职工号 vector course 教授课程 float score 教学效果综合评分 public CTeacher CTeacher string name int age 0 char sex M CPerson name age sex void SetData string title string teano this title title this teano teano void SetCourse string c1 string c2 string c3 course push back c1 course push back c2 course push back c3 void SetScore float score this score score void ShowInfo cout teano t GetName t GetAge t GetSex M 男 title t course 0 t course 1 t course 2 t score title one title this teano one teano this course 0 one course 0 this course 1 one course 1 this course 2 one course 2 this score one score vector GetCourse return course string GetTitle return title string GetTeano return teano float GetScore return score class CNode friend class CList private CTeacher data CNode next class CList private CNode head 7 CNode tail CNode p CNode pre int num 当前节点数 public int MainMenu cout 1 显示当前记录 endl cout 2 添加记录 endl cout 3 排序 endl cout 4 查找 endl cout 5 创建新纪录 endl cout 0 退出 endl cout choice return choice void MainMenuControl ReadData while 1 int choice MainMenu if choice 0 break switch choice case 1 Print break case 2 Append break case 3 SortMenuControl break case 4 SearchMenuControl break case 5 NewList break cout c if c y Save void ReadData 8 head tail new CNode head next NULL num 0 char fname 80 cout fname ifstream file fname if file cout 出现未知错误导致无法打开 teano name age sex title course 0 course 1 course 2 sco re p new CNode p data SetNameAndSex name sex p data SetAge age p data SetData title teano p data SetCourse course 0 course 1 course 2 p data SetScore score tail next p tail p num tail next NULL void Print for p head next p NULL p p next p data ShowInfo cout endl void Append while 1 9 p new CNode cout 请输入 endl cout name cout age cout sex p data SetNameAndSex name sex p data SetAge age cout title cout teano p data SetData title teano cout course 0 course 1 course 2 p data SetCourse course 0 course 1 course 2 cout score p data SetScore score p next tail next tail next p tail p num char c cout c cin get if c y break tail next NULL Print int SortMenu 10 cout 1 按职工号排序 endl cout 2 按教学效果综合评分排序 endl cout 0 退出 endl cout choice return choice void SortMenuControl while 1 int choice SortMenu if choice 0 break switch choice case 1 SortByTeano break case 2 SortByScore break Print void InsertByTeano CNode newp for pre head p head next p NULL pre p p p next if newp data GetTeano data GetTeano break newp next p pre next newp void SortByTeano p head next head next NULL CNode nextp while p NULL nextp p next InsertByTeano p p nextp 11 void InsertByScore CNode newp for pre head p head next p NULL pre p p p next if newp data GetScore data GetScore break newp next p pre next newp void SortByScore p head next head next NULL CNode nextp while p NULL nextp p next InsertByScore p p nextp int SearchMenu cout 1 按姓名查找 endl cout 2 按课程查找 endl cout 0 退出 endl cout choice return choice void SearchMenuControl while 1 int choice SearchMenu if choice 0 break switch choice case 1 SearchByName break case 2 SearchByCourse break 12 void SearchByName int n 0 cout name for p head next p NULL p p next if p data GetName name p data ShowInfo n if n 0 cout 没有相关记录 endl cout endl void SearchByCourse int n 0 cout c for p head next p NULL p p next vector course p data GetCourse for int i 0 idata ShowInfo n break if n 0 cout 没有相关记录 endl cout next NULL while 1 p new CNode cout 请输入 endl cout name cout age cout sex p data SetNameAndSex name sex p data SetAge age cout title cout teano p data SetData title teano cout course 0 course 1 course 2 p data SetCourse course 0 course 1 course 2 cout score p data SetScore score tail next p tail p num cout c cin get if c y break tail next NULL 14 void Save char fname 80 cout fname ofstream file fname if file cout 出现未知错误导致无法打开 next p NULL p p next vector course p data GetCourse file data G

温馨提示

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

评论

0/150

提交评论