




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、实验二实验项目名称:线性表的基本操作实验项目的和要求:掌握线性表的特点掌握线性表的顺序存储结构和链式存储结构的基本运算。尽可能考虑算法的健壮性实验报告中要写出测试数据、错误分析以及收获。上机实验内容四:运动会记分子系统或学生成绩管理子系统1参加运动会的N个学校编号为1N。比赛分成M个男子项目和W个女子项目,每个项目取前3名,得分分别为5,3,2。写一个程序产生各种成绩单和得分报表。完成功能包括如卞:产生一总成绩表,包括:系名、男子团体总分、女子团体总分、团体总分存储结构要求用线性表的顺序存储。实验报告中要写出测试数据、错误分析以及收获。若选择学生成绩管理子系统,可仿照运动会记分子系统完成相关的
2、插入、删除、查找及各种统计工作。实验代码如下:#include#include#include#include#definenull0#definelengthsizeof(structstudent)structstudentintstuid;charstuname20;charstusex2;floatenglish;floatmath;floatdatabase;floatsum;floataverage;structstudentFext;;structstudent*Insert(intn)pl-sum=pl-english+plmath+pldatabase;structstude
3、nt*head/*pl/*p2;for(inti=O;istuid);printf(scanf(,%s,pl-stuname);printf(scanf(,%s,pl-stusex);printf(scanf(,%f,&pl-english);printf(scanf(,%f,&pl-math);printf(n请输入学生的学号:J;请输入学生的姓名:J;请输入学生的性别:J;请输入学生的英语成绩:J;请输入学生的高数成绩:);请输入学生的数据结构成绩:H);scanf(,%f,&pl-database);pl-average=pl-sum;head=pl;p2sum=p2english+p2
4、math+p2database;plonext二null;p2sum=p2english+p2math+p2database;p2sum=p2english+p2math+p2database;else*请输入第:1个学生的信息printf(nprintf(*nJ+l);printf(p2=(structstudent*)malloc(sizeof(structstudent);printf(请输入学生的学号:“);scanf(,%d,&p2-stuid);printf(请输入学生的姓名:“);scanf(,%s,p2-stuname);printf(请输入学生的性别:“);scanf(,%s
5、,p2-stusex);printf(请输入学生的英语成绩:);scanf(,%f,&p2-english);printf(请输入学生的高数成绩:);scanf(,%f,&p2-math);printf(请输入学生的数据结构成绩:);scanf(,%f,&p2-database);p2average=p2-sum;plnext=p2;scanf(吆化&pl-database);pl=p2;p2next=null;returnhead;voidSinsert(structstudent*head)structstudent*pl,*p2;p2=head;pl=(structstudent*)ma
6、lloc(sizeof(structstudent);printf(请输入学生的学号:);scanf(吆d:&plstuid);printf(请输入学生的姓名:);scanf(,%s,/pl-stuname);printf(请输入学生的性别:);scanf(,%s,/pl-stusex);printf(请输入学生的英语成绩:“);scanf(%化&pl-english);printf(请输入学生的高数成绩:“);scanf(,%f,l/&pl-math);printf(请输入学生的数据结构成绩:“);pl-sum=pl-english+plmath+pldatabase;pl-average=
7、pl-sum;讦(head=二null)head=pl;plnext=null;elsewhile(p2-next!=null)p2=p2-next;if(p2-next!=null)plnext=p2-next;p2next=pl;elsep2next=pl;plnext=null;voidprintln()printf(HprintfC*printf(u宣*穴*穴*穴*穴*穴*宣*宣*穴*穴*穴*穴*宣穴*穴*穴*穴*n“)*欢迎使用学生管理系统*n);printf(11*)stuid!二num&p-next!二null)q=p;p=p-next;if(p-stuid=num)if(p=h
8、ead)head=p-next;elseqnext=p-next;printf(#被删除学生的信息#nn“);printf(”);printfC学号姓名性别英语高数数据结构总分平均分W11);printf(%d%s%s%6.1f%6.1f%6.1f%6.1f%6.1fnn,p-stuid/p-stunamezp-stusex,p-english,p-math/p-database,p-sum,p-average,p-sum/p-average);printf(H)/free(p);elseprintf(M#友情提示!找不到该用户的资料!voidSearch(structstudent*head
9、,intnum)structstudent*p;p=head;if(p=二null)printf(H#友情提示!链表为空#扒nnJ;elsewhile(p!=null)if(p-stuid=二num)构总分printf(-);printf(H学号平均分nn);姓名性别英语高数数据结printfC%d%s%s%6.1f%6.1f%6.1f%6.1f%6.1fnn,p-stuid,p-stunamezp-stusex,p-english/p-math/p-database,p-sum,p-average,p-sum/paverage);printf(N);elseprintf(#友情提示!没有该用
10、户的信息#nn”);p=p-next;voidclass_average(structstudent*head)structstudent*pl;pl=head;floati=0,e=0zm=0,d=0;if(pl=null)printfC*#友情提示,该系统中没有用户!#”);floatenglishl=O,mathl=O,database。;while(pl!=null)i+;englishl=englishl+pl-english;if(pl-english=60)e+;mathl=mathl+pl-math;if(pl-math=60)m+;databasel=databasel+pl
11、-database;if(pl-database=60)d+;pl=pl-next;floatavel=englishl/i;floatave2=mathl/i;floatave3=databasel/i;printfC1xok*n)printff1*各科均分及及格率的查询*nH);printff1*nn)printf(),printff1英语高数数据结构nnH);printf(均分:%6.1f%6.1f%6.1fnnH,avel,ave2zave3);printfC及格率:%6lf%61俠%nn,/e/iUOO,m/i*100,d/i*100);printf();voidResult_sor
12、t(structstudent*head)inti=0;structstudentend;structstudent*p;structstudent*pl;structstudent*p2;structstudent*p3;pl=(structstudent*)malloc(length);plnext=head;head=pl;for(end=null;end!=head;end=p)for(p=pl=head;plnext-next!=end;pl=pl-next)if(pl-next-sumnextnext-sum)p2=plnextnext;plnext-next=p2next;p2n
13、ext=pl-next;plnext=p2;p=plnext-next;pl=head;head=head-next;free(pl);p3=head;printff学号姓名性别英语高数数据结构总分平均分nn);printf(Hwhile(p3!=null)printf(H%d%s%s%6.1f%6.1f%6.1f%6.1f%6.1f%dnnzp3-stuid/p3-stuname/p3-stusex,p3-english,p3math,p3database,p3sum,p3average,p3-sum,p3-average);p3=p3-next;printf(H);voidshow_max
14、(structstudent*head)printf(H宣*穴)()4(*宣穴*穴*穴*宣穴*穴*穴*穴*宣*宣*穴*宣穴*穴*)4(*穴*穴*宣穴*n“)printfC*各科最高分学生信息*n);printfCprintff11);structstudent*pl,*p2,*p3;floatmaxl=0,max2=0,max3=0;for(pl=head;pl-next!=null;pl=pl-next)讦(pl-englishplnextenglish)maxl=pl-english;elsemaxl=pl-next-english;for(p2=head;p2-next!=null;p2
15、=p2-next)if(p2-mathp2-next-math)max2=p2-math;elsemax2=p2-next-math;for(p3=head;p3-next!=null;p3=p3-next)讦(p3-databasep3-next-database)max3=p3-database;elsemax3=p3-next-database;printf(H英语:%6.1fnn,maxl);printf(高数:%6.1fnn/max2);printf(数据结构:%6.1fnn,max3);printfl11-voidmain()println();structstudent*head
16、;while(l)printf(H#请输入您要进行的操作#nrf);inti;scanf(”d”,&i);switch(i)case1:intn;printf(#请输入您要批量的个数:#nn”);scanf(“2d“,&n);head=lnsert(n);break;case2:Sinsert(head);break;case3:intnum2;printf(#请输入要查找学生的学号:scanf(”10cT:&num2);Search(head,num2);break;case4:intnuml;printf(#请输入要删除学生的学号scanfflOd&numl);Delete(head,nu
17、ml);break;case5:Result_sort(head);break;case6:show_max(head);break;case7:class_average(head);break;case&printf(printf(N#感谢您使用一再见printf(return;break;欢迎使用学注管理系统U1.批星添加学生信息3杳找某个学注XXKK5按成绩进行排名?各舉均分及及恪率X-X-X-XXX洛WXXM-彳洛WXXM-彳洛WXXM-彳洛WXXM-WX,XXXMXXKXXMXXKXXMXXKXXMXXMXXXXMXKXXXMXKXXXMXKXXXMXKXX2插入单个学生K4册J除
18、某个学生K6显示各科最rSj分xxxx8退出管理系统*二二,t:ttHSH333一tt入入入入入入ttttinM01-s-冃请tt22旧讪/+r工h丁丈入侣二口n兀岂:o75ttttttttttttttttttttit输入您要逬行的操作tttttttttttttttttttttt3ttttttttttttttttttlt输入要查找学生的学号.tttttttttttttttttttt101学号姓名性别英语高数数据结构总分平均分101wunanMMB11.022.033.066.022.0tttttttttttttttttttt请输入您要进行的操作Itttttttttlttttttttttt学号姓名性别英语高数数据结构总分平均分103dongnan44.085.065.0194.064.71102jiannv22.055.088.0165.055.00101VIUnan11.022.033.066.022.00ttttttS#tt#it224IUHUUU-U4IU-HU作3nq-n咸进威成结您号名别i入的的的的的的请4二土.fcM二土二二41dTr占吕斗与i瓷吹入X入ix4llt请请请请请请呱各科均分及及格率的查询英语高数数据结构均分:25.?54.062.0及格率:0.0Z33.3z66.7
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 六盘水职业技术学院《流行音乐赏析》2023-2024学年第一学期期末试卷
- 昆明冶金高等专科学校《跨文化商务沟通》2023-2024学年第二学期期末试卷
- 山西信息职业技术学院《大数据分析与可视化》2023-2024学年第二学期期末试卷
- 四川音乐学院《GIS应用开发》2023-2024学年第二学期期末试卷
- 山西临汾霍州三中重点中学2025年新中考数学试题一轮复习专题跟踪检测试题含解析
- 内蒙古自治区通辽市2025年中考全真模拟(三)语文试题含解析
- 宁夏大学新华学院《幼儿园教育案例分析》2023-2024学年第二学期期末试卷
- 内蒙古医科大学《水工钢筋混凝土结构及钢结构》2023-2024学年第二学期期末试卷
- 教育培训场地租赁合同书
- 合伙转让协议书二零二五年
- 外墙憎水岩棉保温板施工方案doc
- 门店清洁卫生标准
- 联想集团财务风险分析及对策论文财务管理专业
- 阿丁尿床了(2)
- 工会会计报表完整版(内有6张表)
- 双碱法脱硫设计计算
- 巴基斯坦1X150MW设备清册
- 增值税销售货物或者提供应税劳务清单(标准模板)
- 医用耗材分类目录 (低值 ╱ 高值)
- competition-model
- 退档申请书怎样写
评论
0/150
提交评论