




已阅读5页,还剩8页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
学生成绩管理系统学生成绩管理系统 一 一 实验目的实验目的 1 通过此次课程设计中学生成绩管理系统的题目 掌握链表等数据结构的 基本操作方面的知识 并能灵活的解决一些基本的问题 加深对其性质及各项操 作的理解 2 将所学数据结构方面的知识与一门具体的语言 C 语言来进行实现 感受数据结构的强大作用 加深理解 二 二 试验要求试验要求 管理系统中有五个要求 输入 查找 修改 插入 删除 存储 1 输入要求 能够通过键盘输入和文件输入两种 2 查找要求 能够根据学生号查找单个学生的信息 也可以遍历所有学生信息 3 修改要求 能够根据学生号修改单个学生所有信息 4 插入要求 能够实现头插和尾插 5 删除要求 能够根据学生号删除单个学生信息 6 存储要求 通过链表存储所有信息 三 三 算法的思想与算法实现步骤算法的思想与算法实现步骤 1 基本思想 通过链表数据类型进行基本操作 主要有三个模块 分别是主函数模块 主要操作函数及基本操作函数 其中 主函数负责其他子函数的调用实现以及基本界面的操作 主要函数包括 void StuInput Student 学生成绩管理系统的输入函数 由主函数调用 void StuSelect Student 学生成绩管理系统的查找函数 由主函数调用 void StuAlter Student 学生成绩管理系统的修改函数 由主函数调用 void StuInsert Student 学生成绩管理系统的插入函数 由主函数调用 void StuDelect Student 学生成绩管理系统的删除函数 由主函数调用 Comment 微微微微1 void StuSave Student 学生成绩管理系统的存储函数 由主函数调用 基本操作函数 void StuOutput Student p 输出函数 int StuImport Student head Student p 输入函数 void StuInputHand Student head 学生成绩管理系统的手动输入函数 由输入函 数调用 void StuInputFile Student head 学生成绩管理系统的文件输入函数 由输入函 数调用 void StuSelectErg Student head 学生成绩管理系统的遍历函数 由查找函数调 用 void StuSelectNumFind Student head 学生成绩管理系统的按学号查找函数 由 查找函数调用 void StuSelectSubFind Student head 学生成绩管理系统的按科目查找函数 由 查找函数调用 2 实现步骤 首先 分析题目要求划分实现模块 定义基本数据类型 诸如结构体 链 表等 其次 针对上述的基本操作实现具体需要进行的操作 具体实现每个环节 需要进行的基本操作 即具体编写每个小函数实现功能 最后 编写主函数对每个实现进行按需调用 实现操作 3 流程图 StuMain StuInputStuSelectStuAlterStuInsertStuDelectStuSave StuInput Hand StuInput File StuSelectE rg StuSelectN umFind StuSelectSub Find 四 代码 四 代码 include include include struct Student char name 10 char subject 10 int num int grade Student next void StuMain 学生成绩管理系统的主函数 由 main 函数调用 void StuInput Student 学生成绩管理系统的输入函数 由主函数调用 void StuSelect Student 学生成绩管理系统的查找函数 由主函数调用 void StuAlter Student 学生成绩管理系统的修改函数 由主函数调用 void StuInsert Student 学生成绩管理系统的插入函数 由主函数调用 void StuDelect Student 学生成绩管理系统的删除函数 由主函数调用 void StuSave Student 学生成绩管理系统的存储函数 由主函数调用 void StuOutput Student p 输出函数 int StuImport Student head Student p 输入函数 main void StuOutput Student p 打印函数 将链表的该节点信息输出 printf 学生姓名 printf s p name printf 学生号 printf d p num printf 科目 printf s p subject printf 学生成绩 printf d n p grade int StuImport Student head Student p Student Opinion Student malloc sizeof Student 用来判断输入节点 中学生号是否有重复 Opinion head next printf 学生姓名 n scanf s p name printf 学生号 n scanf d printf 科目 n scanf s p subject if Opinion NULL if Opinion num p num return 1 Opinion Opinion next printf 学生成绩 n scanf d return 0 void main StuMain void StuMain char decide y 定义 while 变量 函数是否继续进行 int num 1 定义 switch 变量 函数跳转到哪个 子函数 Student head 定义链表的头指针 head Student malloc sizeof Student 给头指针开辟空间 head next NULL 初始化头指针 while decide n printf n printf 1 输入 2 查找 3 修改 4 插入 n printf 5 删除 6 存储 7 退出 n printf n scanf d switch num case 1 StuInput head break case 2 StuSelect head break case 3 StuAlter head break case 4 StuInsert head break case 5 StuDelect head break case 6 StuSave head break default decide n break void StuInputHand Student head 学生成绩管理系统的手动输入函数 由输入函数调 用 void StuInputFile Student head 学生成绩管理系统的文件输入函数 由输入函数调用 void StuInput Student head 学生成绩管理系统的输入函数 由主函数调用 char decide y 定义 while 变量 函数是否继续进行 int num 定义 switch 变量 函数跳转到哪个子 函数 while decide n printf n printf 1 手动输入 2 文件输入 3 退出 n printf n scanf d switch num case 1 StuInputHand head break case 2 StuInputFile head default decide n break void StuInputHand Student head 学生成绩管理系统的手动输入函数 由输入函数调用 if head next NULL Student point Student malloc sizeof Student 链表中最后一个 节点 只在该函数中存在 point next NULL int decide 1 while decide 0 Student p Student malloc sizeof Student p next NULL StuImport head p if head next NULL head next p point p else point next p point p printf 是否继续 1 0 n scanf d else printf 管理系统中已存在信息 若想输入学生信息 请转插入子系统 void StuInputFile Student head 学生成绩管理系统的文件输入函数 由输入函数调用 if head next NULL printf 学生管理系统中已有信息 请跳转到插入选项 n return FILE fp printf 请输入文件名 包括物理地址 n char filename 10 scanf s filename if fp fopen filename r NULL printf can not open file n return Student point Student malloc sizeof Student Student Opinion Student malloc sizeof Student 用来判断输入 节点中学生号是否有重复 while feof fp Opinion head next Student p Student malloc sizeof Student p next NULL fread p sizeof Student 1 fp if Opinion NULL if Opinion num p num head next NULL return Opinion Opinion next if head next NULL head next p point p else point next p point p Opinion head next while Opinion next NULL Opinion Opinion next if Opinion next next NULL Opinion next NULL fclose fp printf 传输成功 n void StuSelectErg Student head 学生成绩管理系统的遍历函数 由查找函数调用 void StuSelectNumFind Student head 学生成绩管理系统的按学号查找函数 由查找函 数调用 void StuSelectSubFind Student head 学生成绩管理系统的按科目查找函数 由查找函 数调用 void StuSelect Student head 学生成绩管理系统的查找函数 由主函数调用 char decide y 定义 while 变量 函数是否继续进行 int num 定义 switch 变量 函数跳转到哪个子 函数 while decide n printf n printf 1 遍历 2 学号查找 3 科目查找 4 退出 n printf n scanf d switch num case 1 StuSelectErg head break case 2 StuSelectNumFind head break case 3 StuSelectSubFind head break default decide n break void StuSelectErg Student head 学生成绩管理系统的遍历函数 由查找函数调用 Student p Student malloc sizeof Student p head next int i 1 while p NULL printf 第 d 位学生信息 n i StuOutput p p p next i void StuSelectNumFind Student head 学生成绩管理系统的查找子系统 有查找函数调 用 int num printf 输入想要查找学生的学生号 n scanf d Student p Student malloc sizeof Student p head next int i 1 while p NULL if num p num StuOutput p i p p next if i 1 printf 没有该学生信息 void StuSelectSubFind Student head 学生成绩管理系统的按科目查找函数 由查找函 数调用 char Sub 10 printf 输入想要查找科目 n scanf s Sub Student p Student malloc sizeof Student p head next int i 1 while p NULL if strcmp Sub p subject StuOutput p i p p next if i 1 printf 没有该学生信息 void StuAlter Student head 学生成绩管理系统的修改函数 由主函数调用 int num printf 输入想要查找学生的学生号 n scanf d char Sub 10 printf 输入想要查找科目 n scanf s Sub Student p Student malloc sizeof Student p head next int i 1 while p NULL if num p num scanf d printf 修改成功 n i p p next if i 1 printf 没有该学生信息 void StuInsert Student head 学生成绩管理系统的插入函数 由主函数调用 Student point Student malloc sizeof Student point head next while point next NULL point point next 找到尾结点 char decide y 定义 while 变量 函数是否继续进行 int num 定义 switch 变量 函数跳转到哪个子函数 while decide n printf n printf 1 头插 2 尾插 3 退出 n printf n scanf d Student p Student malloc sizeof Student switch num case 1 StuImport head p p next head next head next p printf 插入成功 n break case 2 StuImport head p point next p p next NULL printf 插入成功 n break default
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 入路职工安全培训宣传课件
- 例检员安全培训计划课件
- 2026届山西省晋中市榆社中学物理高三上期末监测试题
- 邯郸常态化管理办法
- 工业化的起步和人民代表大会制度的确立讲课文档
- 校友基金官方管理办法
- 社区疫苗接种管理办法
- 高级导游等级考试(导游综合知识)在线自测试题库及答案(2025年湖南省)
- 跨文化抑郁差异-洞察及研究
- 机载数据森林覆盖变化监测-洞察及研究
- 正性肌力药物在心力衰竭中的应用-课件-幻灯-ppt
- 北京师范大学心理学学术学位研究生培养方案(2023版)
- 施工总平面布置图及说明及施工现场平面布置图
- 镇村综治中心治安防控室工作台账(完整打印版)
- (4)-2.灾难现场的检伤分类
- 课程设计(集装箱专用平车总体设计)
- 上肢主要神经损伤诊断
- GB/T 24600-2009城镇污水处理厂污泥处置土地改良用泥质
- GB/T 1839-2008钢产品镀锌层质量试验方法
- 炼油厂生产准备工作纲要(终)
- 静脉输注药物临床合理应用与注意事项课件
评论
0/150
提交评论