数据结构课程设计ppt.ppt_第1页
数据结构课程设计ppt.ppt_第2页
数据结构课程设计ppt.ppt_第3页
数据结构课程设计ppt.ppt_第4页
数据结构课程设计ppt.ppt_第5页
已阅读5页,还剩31页未读 继续免费阅读

下载本文档

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

文档简介

数据结构 学生成绩管理系统 吴灵珊 许梅琼 梁春梅 14计科2班第12组 王芬岚 2020 4 9 A 问 基本操作函数 学生成绩管理系统 01 02 03 04 问题描述 结构分析 基本操作函数 运行 14计科2班第12组 voidStuSave Student 学生成绩管理系统的存储函数 由主函数调用基本操作函数 voidStuOutput Student p 输出函数intStuImport Student head Student p 输入函数voidStuInputHand Student head 学生成绩管理系统的手动输入函数 由输入函数调用 voidStuInputFile Student head 学生成绩管理系统的文件输入函数 由输入函数调用voidStuSelectErg Student head 学生成绩管理系统的遍历函数 由查找函数调用voidStuSelectNumFind Student head 学生成绩管理系统的按学号查找函数 由查找函数调用voidStuSelectSubFind Student head 学生成绩管理系统的按科目查找函数 由查找函数调用 2020 4 9 源程序 2020 4 9 include 输入输出头文件 include include include includeclassstudent 班级学生 private charname 20 姓名doublecpro english math sport law hbpro computer 课程intorder number 名次 学号public student student charn 20 intnu doublecc doubleeng doublema doublesp double 2020 4 9 l doublehb doublecom strcpy name n number nu cpro cc english eng math ma sport sp law l hbpro hb computer com friendvoidmain voidmain cout 欢迎进入 学生成绩管理系统 endl cout endl 2020 4 9 cout 学生成绩管理系统 endl cout endl cout endl cout 0 输入数据 endl cout 1 增加数据 endl cout 2 修改数据 endl cout 3 按姓名查询 endl cout 4 按学号查询 endl cout 5 输出所有学生的成绩 endl cout 6 退出系统 endl cout endl cout 选择0 6数字进行操作 endl 2020 4 9 charp charw 定义字符型p wstudent s 50 指针对象 最多存50个学生数据ofstream file 50 负责对文件插入操作inti 0 定义初始化i 0intj 0 定义初始化j 0intflag 0 定义变量初始化变量等于0do flag判断输入是否有效 cin p if p 0 else cout 指令错误 请重新输入 endl 2020 4 9 while flag 0 do switch p 接收功能选项 case 0 输入数据 charc 定义一个字符型ccharname 20 intnumber doublecpro english math sport law hbpro computer 定义了一个数组 数组名为name 数组元素的个数为20定义do cout name cout number 2020 4 9 cout cpro cout english cout math cout sport cout law cout hbpro cout endl 请输入数据库成绩 2020 4 9 cin computer cout c cout endl do 2020 4 9 if c y double 2020 4 9 cpro english math sport law hbpro computer charc do cout name cout number cout cpro cout english cout endl 请输入数学成绩 2020 4 9 cin math cout sport cout law cout hbpro cout computer cout endl file j newofstream d document ios ate file j 姓名 name 学号 2020 4 9 c cout c 2020 4 9 while c y break case 2 修改数据 charname 20 intnu doublecc eng ma sp l hb com flag 0 charc if i 0 cout 管理系统中没有输入数据 endl break do 2020 4 9 cout name coutname 0 flag 1 cout nu cout cc cout endl 请输入英语成绩 2020 4 9 cin eng cout ma cout sp cout l cout hb cout com coutcpro cc 19 可编辑 2020 4 9 s h english eng s h math ma s h sport sp s h law l s h hbpro hb s h computer com s h number nu cout 数据修改成功 endl if flag 0 判断要修改的学生数据是否存在 cout 您要修改的学生本来就不存在 请检查重新输入 endl 2020 4 9 cout c cout c while c y break 2020 4 9 case 3 按姓名查询 charn 20 intj 0 charc if i 0 学生姓名不存在的情况 cout n cout endl for intj 0 j i j 2020 4 9 if strcmp n s j name 0 flag 1 cout c 2020 4 9 cout c while c y 输入Y表示继续按照姓名查询break case 4 按学号查询 intn j 0 charc 2020 4 9 if i 0 学生数据不存在的情况 cout n coutnumber n flag 1 2020 4 9 cout c cout c 2020 4 9 while c y y x是赋值语句 表示将x的值赋值给y 那么while y x 可以理解为当x 0 即y x 0时跳出循环 如果x为其它非零数 则执行循环体 break case 5 输出 cout 本系统所有学生数据如下 endl 输出if i 0 cout 管理系统中没有输入数据 endl cout 姓名学号c 英语数学体育网络基础C语言数据库 endl for intk 0 k i k 2020 4 9 coutnamenumber setw 6 函数setw intn 用来控制输出间隔 超出则按实际长度输出 s k cpro setw 6 s k english setw 6 cpro与english间隔为6 s k math setw 6 s k sport setw 7 s k law setw 10 s k hbpro setw 10 s k computer setw 10 endl break case 6 退出 exit 0 cout Byebye endl 输出Byebye cout 您想继续进行其他操作吗 y n intflag 0 定义一个int型变量flag 并且给flag赋初始值为0do 2020 4 9 cin w 标准输入流相当于c的scanfcout endl if w y 2020

温馨提示

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

评论

0/150

提交评论