




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1 第一部分第一部分 学生成绩管理系统设计 3 问题描述 3 需求分析 3 概要设计 3 详细设计 5 调试分析 算法优劣 5 源程序 6 第二部分第二部分 心得体会 10 项目分工 10 2 二 二 学生成绩管理系统学生成绩管理系统 1 问题描述 问题描述 试编写一个管理系统 要求 1 实现对两个文件数据进行合并 生成新文件 3 txt 2 抽取出三科成绩中有补考的学生并保存在一个新文件 4 txt 3 对合并后的文件 3 txt 中的数据按总分降序排序 至少采用两种排序方法 实现 4 输入一个学生学号后 能查找到此学生的其它信息并输出结果 至少采用 两种查找方法实现 要求使用结构体 链或数组等实现上述要求 现有学生成绩信息文件 1 1 txt 内容如下 姓名 学号 语文 数学 英语 张明明 01 67 78 82 李成友 02 78 91 88 张辉灿 03 68 82 56 王露 04 56 45 77 陈东明 05 67 38 47 学生成绩信息文件 2 2 txt 内容如下 姓名 学号 语文 数学 英语 陈果 31 57 68 82 李华明 32 88 90 68 张明东 33 48 42 56 李明国 34 50 45 87 陈道亮 35 47 58 77 文件内容可根据测试要求 自行制定 2 需求分析 需求分析 建立一个 studentinfo 的结构 定义学生信息 姓名 学号 语数外成绩 的成 员变量 用 main 函数进行实际操作 1 合并两个文件数据 生成新文件 2 抽取出三科成绩中有补考的学生并保存在一个新文件 3 对合并后的文件中的数据按总分降序排序 至少采用两种排序方法实现 4 输入一个学生学号后 能查找到此学生的其它信息并输出结果 至少采用两 种查找方法实现 3 概要设计 概要设计 1 设计思想 建立结构体数组 存储具体的文件信息 用循环条件语句对数据进行具体操 作 循环语句合并文件 循环条件语句挑选不及格的学生 选择法进行排序 3 2 实现方法 定义输入输出流变量 定义studentinfo型的数组变量 用来读取1 txt和 2 txt中的内容以及把操作后的数据保存到3 txt 4 txt 5 txt 用两个循环读取1 txt和2 txt中的项目 再用一个循环读取1 txt和2 txt 中的具体的学生信息 用两个循环将读取出来的内容写入3 txt 打开已经形成的3 txt 读取其中的数据 用循环和选择语句选出有不及格 的学生保存到4 txt中 仍然使用刚刚打开的3 txt中的数据 求和 排序 将结果保存到5 txt 3 数据结构 struct studentinfo string name 姓名 int id 学号 int chinese 语文 int math 数学 int english 英语 定义studentinfo型结构体 4 算法流程图 4 N 查询 排序 5 txt不及格 4 txt 合并为3 txt 1 txt2 txt Y 开始 结束 5 5 详细设计详细设计 见源程序见源程序 6 6 调试分析 算法优劣 调试分析 算法优劣 1 时间复杂度分析 O n 空间复杂度 O 1 2 优 在程序中没有出现文档中的任何内容 所有的数据都是基于文档的 缺 当输入不存在的学号时不会提示该学号为空 5 源代码 include include include include using namespace std struct studentinfo string name 姓名 int id 学号 int chinese 语文 int math 数学 int english 英语 定义 studentinfo 型结构体 int main ifstream infileOne ifstream infileTwo ifstream infileThree 定义输入流变量 ofstream outfileThree ofstream outfileFour ofstream outfileFive 定义输出流变量 studentinfo first 10 studentinfo second 10 定义两个 studentinfo 型的数组 int count string subject 10 infileOne open d 1 txt 打开文件 1 infileTwo open d 2 txt 打开文件 2 outfileThree open d 3 txt 打开文件 3 for count 0 count subject count 读入文件 1 的各项条目 outfileThree setw 6 subject count 将各项条目写入文件 3 for count 0 count subject count 读入文件 2 的各项条 目 outfileThree endl 换行 for count 0 count first count name first count id first count chinese first count math first count english infileTwo second count name second count id second count chinese second count math second count english outfileThree fixed showpoint setprecision 2 for count 0 count 5 count 将 文件 1 中的学生信息写入到文件 3 中 outfileThree setw 6 first count name setw 6 first count id setw 6 first count chinese setw 6 first count math setw 6 first count english endl for count 0 count 5 count 将 文件 2 中的学生信息写入到文件 3 中 outfileThree setw 6 second count name setw 6 second count id setw 6 second count chinese setw 6 second count math setw 6 second count english endl infileOne close infileTwo close outfileThree close 关闭文件 1 2 3 infileThree open d 3 txt 打开文件 3 outfileFour open d 4 txt 打开保存不 及格学生的文件 4 outfileFive open d 5 txt 打开进行降 序排序的文件 5 for count 0 count subject count outfileFive setw 6 subject count 读入文件 3 的各项条目 并且 写入到文件 5 中 outfileFive endl for count 0 count first count name first count id first count chinese first count math first count english 从文件 3 中读出各个学生的 各项数据 for count 0 count 10 count if first count chinese 60 first count math 60 first count english 60 outfileFour first count name endl 选择有不及格 科目的学生写入到文件 4 中 int number 10 int Count int Temp studentinfo temp for count 0 count 10 count number count first count chinese first count math first count english 将语数外成绩总和赋值给 number for Count 0 Count 10 Count for count Count 1 count 10 count if number Count number count Temp number count number count number Count number Count Temp temp first count first count first Count first Count temp 选择排序 for count 0 count 10 count outfileFive setw 6 first count name setw 6 first count id setw 6 first count chinese setw 6 first count math setw 6 first count english endl 8 将排序好的数据写入 5 txt 中 int ID cout ID int n 0 for count 0 count 10 count if ID first count id cout setw 6 subject 0 setw 8 first count name setw 6 subject 1 setw 3 first count id setw 6 subject 2 setw 3 first count chinese setw 6 subject 3 setw 3 first count math setw 6 subject 4 setw 3 first count english endl 顺序查询学生信息 n 1 if n 0 cout 没有该学生 endl 未查询到该生信息 return 0 9 三 三 心得体会心得体会 六周的算法与数据结构的课程设计 让我们了解并掌握了数据结构与算法的设 计方法 现在我们具备了初步的独立分析和设计能力 初步掌握了软件开发过 程的问题分析 系统设计 程序编码 测试等基本方法和技能 总结一下 有以下几点体会 1 基础知识必须牢固掌握 由于编程过程中需要采用很多算法 所以需要牢固 掌握 算法与数据结构 这门知识 同时 c 语言知识编程的基础 也必须牢固 掌握 2 在做课程设计的时候
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 兴化安全管理培训中心课件
- 【含听力7英RJ月考】安庆市太湖县实验中学教育集团2024-2025学年七年级上学期第一次月考英语试卷
- 创新安全培训观念课件
- 创客你我他课件
- 耐药机制阻断策略-洞察及研究
- 统编版语文三年级上册第二单元习作写日记 +公开课一等奖创新教案
- 脑机接口与行为认知的虚拟现实研究-洞察及研究
- 化妆品安全知识培训方案课件
- 兆驰入职安全培训课件
- 软件无线电加密-洞察及研究
- 财务预算培训课件
- 高桩码头施工培训课件
- 砂石加工现场管理制度
- it部门考核方案(3篇)
- 山东C类人员安全考核模拟练习题及参考答案解析
- 中通规章管理制度
- 茶山管理协议书
- 代办土地证协议书
- 创意美术课程教学大纲
- 2025年生物性污染对人体健康的危害与生物安全防控措施
- 现代文献检索与利用3-文献检索技术
评论
0/150
提交评论