已阅读5页,还剩16页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
include include include include define INIT SIZE 10 define INCRE SIZE 10 define SUBJECT NUM 3 define LEN 3 void show Start void show Table void addRecord void Info delete void deleteRecord void delete Num int void delete Name char tarName void Info modify void modifyRecord void modify Num int void modify Name char void Info query void queryRecord void query Num int void query Name char void display void quit void menu CMD char subject SUBJECT NUM struct STUDENT 2 int num char name 20 char sex float score SUBJECT NUM struct STUDENT stu LEN 1 STUDENT record STUDENT malloc sizeof STUDENT INIT SIZE int static stuNum 0 STUDENT record STUDENT malloc sizeof STUDENT INIT SIZE int main record STUDENT malloc sizeof STUDENT INIT SIZE STUDENT record STUDENT malloc sizeof STUDENT INIT SIZE record 1 num 1001 strcpy record 1 name Jason record 1 sex M record 1 score 0 85 0 record 1 score 1 90 0 record 1 score 2 95 0 record 2 num 1002 strcpy record 2 name Jerry record 2 sex M record 2 score 0 85 0 record 2 score 1 90 0 record 2 score 2 95 0 record 3 num 1003 strcpy record 3 name Jessie 3 record 3 sex F record 3 score 0 85 0 record 3 score 1 90 0 record 3 score 2 95 0 Info modify int key cout key if key 1 int targetNum cout cin targetNum modify Num targetNum cout endl display if key 2 char targetName 20 cout targetName modify Name targetName cout endl display if key 3 4 exit 0 show Start menu CMD return 0 void show Start cout endl cout endl cout endl cout endl cout endl cout endl cout Made by Jason endl cout endl void show Table cout t t cout t subject 0 t subject 1 t subject 2 cout endl void menu CMD int key while 1 5 cout 1 endl cout 2 endl cout 3 endl cout 4 endl cout 5 endl cout 6 endl cout key while 1 if key 6 int key cout endl cout key else break switch key case 1 addRecord break case 2 deleteRecord break case 3 modifyRecord break case 4 queryRecord break case 5 display 6 break case 6 quit break void addRecord if stuNum 0 cout endl stuNum else cout INIT SIZE cout endl record STUDENT realloc record INIT SIZE INCRE SIZE sizeof STUDENT cout endl cout endl cout choi if choi Y choi y cout record stuNum num cout record stuNum name cout record stuNum sex int i for i 0 i SUBJECT NUM i cout subject i record stuNum score i if choi N choi n cout endl cout endl cout stuNum endl cout endl deleteRecord void Info delete cout endl cout 1 endl cout 2 endl 8 cout 3 endl void deleteRecord int key cout endl Info delete cout key if key 1 int targetNum cout targetNum delete Num targetNum cout endl if key 2 char targetName 20 cout targetName delete Name targetName cout endl if key 3 while 1 menu CMD 9 void delete Num int tarNum int i for i 1 i stuNum i if record i num tarNum 1 2 if i stuNum cout endl show Table cout record i num t record i name t record i sex t record i score 0 record i score 1 t record i score 2 cout endl cout endl endl show Table for int i 1 i stuNum 1 i cout record i num t record i name t record i sex for int j 0 j SUBJECT NUM j cout t record i score j cout endl 10 stuNum cout stuNum cout endl 2 if i stuNum cout endl show Table cout record i num t record i name t record i sex t record i score 0 t record i score 1 t record i score 2 for int j i 1 j stuNum j record j 1 record j cout endl cout endl show Table for int i 1 i stuNum 1 i cout record i num t record i name t record i sex for int j 0 j SUBJECT NUM j cout t record i score j cout endl stuNum cout stuNum 11 cout endl stuNum cout stuNum cout endl void delete Name char tarName int i for i 1 i stuNum i if strcmp record i name tarName 0 1 2 if i stuNum cout endl show Table cout record i num t record i name t record i sex t record i score 0 record i score 1 t record i score 2 cout endl cout endl endl show Table for int i 1 i stuNum 1 i cout record i num t record i name t record i sex 12 for int j 0 j SUBJECT NUM j cout t record i score j cout endl if i stuNum cout endl show Table cout record i num t record i name t record i sex t record i score 0 t record i score 1 t record i score 2 for int j i 1 j stuNum j record j 1 record j cout endl cout endl show Table for int i 1 i stuNum 1 i cout record i num t record i name t record i sex for int j 0 j SUBJECT NUM j cout t record i score j cout endl cout endl 13 void delete Name char tarName int i for i 1 i stuNum i 1 2 if strcmp record i name tarName 0 if i stuNum cout endl show Table cout record i num t record i name t record i sex t record i score 0 t record i score 1 t record i score 2 cout endl cout endl show Table for int i 1 i stuNum 1 i cout record i num t record i name t record i sex for int j 0 j SUBJECT NUM j cout t record i score j cout endl stuNum cout stuNum cout endl 14 if i stuNum cout endl show Table cout record i num t record i name t record i sex t cout record i score 0 t record i score 1 t record i score 2 cout endl for int j i 1 j stuNum j record j 1 record j cout endl cout endl show Table for int i 1 i stuNum 1 i cout record i num t record i name t record i sex for int j 0 j SUBJECT NUM j cout t record i score j cout endl stuNum cout stuNum cout endl 15 stuNum cout stuNum cout endl void Info modify cout endl cout 1 endl cout 2 endl cout 3 endl void modifyRecord int key cout endl Info modify cout key if key 1 int targetNum cout targetNum modify Num targetNum cout endl display 16 if key 2 char targetName 20 cout targetName modify Name targetName cout endl display if key 3 while 1 menu CMD void modify Num int tarNum int i for i 1 i stuNum i if record i num tarNum cout endl endl cout record i num cout record i name 17 cout record i sex cout subject 0 record i score 0 cout subject 1 record i score 1 cout subject 2 record i score 2 void modify Name char tarName int i for i 1 i stuNum i if strcmp record i name tarName 0 cout endl endl cout record i num cout record i name cout record i sex cout subject 0 record i score 0 cout subject 1 record i score 1 cout subject 2 record i score 2 void Info query 18 cout endl cout 1 endl cout 2 endl cout 3 endl queryRecord void queryRecord int key cout endl Info query cout key if key 1 int targetNum cout targetNum query Num targetNum cout endl if key 2 char targetName 20 cout targetName query Name targetName cout endl if key 3 19 while 1 menu CMD void query Num int tarNum int i for i 1 i s
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024精美预防流感
- 学院资产租赁申请表
- 幼儿园卫生保健工作条例自测题答案
- 幼儿园卫生常识鼠疫防控知识竞赛试题集
- 2026广东深圳市事业单位招聘高校毕业生658人考试笔试参考题库附答案解析
- 2025贵州超航低空产业发展有限责任公司招聘考试笔试模拟试题及答案解析
- 2025内蒙古呼和浩特市北兴产业投资发展有限责任公司猎聘高级管理人员2人考试笔试模拟试题及答案解析
- 2025滨州市人民医院合同制工作人员招聘10人笔试考试参考题库及答案解析
- 2026辽宁大连瓦房店市教育系统自主招聘教师58人笔试考试备考题库及答案解析
- 2026学年上海市文来中学(高中)教师招聘考试笔试参考题库附答案解析
- 供应商具备履行合同所必需的设备和专业技术能力的证明材料8篇
- 第五章一元一次方程 单元教学设计2024-2025学年人教版数学七年级上册
- 2024年度中国物流科技投诉数据与典型案例报告-37正式版
- 2025年电梯考试试题及答案
- 药厂QA年终个人总结
- 《分析化学》课程思政教学案例(一等奖)
- 公共卫生应急物资储备与调配预案
- 2020输变电工程典型设计35kV铁塔型录
- 《保险学原理与应用》 课件 4.7重复保险的分摊原则
- 烟花爆竹零售申请书
- 2025重庆市安全员C证考试(专职安全员)题库及答案
评论
0/150
提交评论