版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、#include #include #include /typedef struct LNode /int stuid;char name20;float english;float math;float database;float sum;float average;struct LNode *next; /LNode,*LinkList;/1.,LinkList Input()int i,n;LinkList L,p;L=(LinkList)malloc(sizeof(LNode);L-next=NULL; /printf(:n);scanf(%2d,&n);/for(i=n;i0;i-
2、)printf(*n);printf(* %d *n,i);printf(*n);p=(LinkList)malloc(sizeof(LNode); /printf();scanf(%d,&p-stuid);printf();scanf(%s,p-name);printf();scanf(%f,&p-english);printf();scanf(%f,&p-math);printf();scanf(%f,&p-database);p-sum=p-english+p-math+p-database;p-average=p-sum/3;p-next=L-next;L-next=p; /retur
3、n L;/2.void Display(LinkList L)LinkList p;p=L-next;/ Lpif(L=NULL)printf(n);elseprintf(:n);printf(ttttttn);while(p)printf(%dt%st%.2ft%.2ft%.2ftt%.2ftt%.2fn,p-stuid,p-name,p-sum,p-average,p-english,p-math,p-database);p=p-next;/3.void Insert(LinkList L)LinkList p;p=(LinkList)malloc(sizeof(LNode);/pprin
4、tf();scanf(%d,&p-stuid);printf();scanf(%s,p-name);printf();scanf(%f,&p-english);printf( );scanf(%f,&p-math);printf();scanf(%f,&p-database);p-sum=p-english+p-math+p-database;p-average=p-sum/3;p-next=L-next;/p L L-next=p;printf(!);/4./void Delete(LinkList L)LinkList p,q;int num,ch;char s20;if(L=NULL)p
5、rintf(n);elsep=L; /L,pq=p-next; /qpprintf(1.n2.n);scanf(%d,&ch);if(ch=1)printf(:);scanf(%s,s);while(strcmp(q-name,s)!=0&q-next!=NULL)p=q;q=q-next;if(strcmp(q-name,s)=0) /q,pp-next=q-next;printf(:n);printf(ttttttn);printf(%dt%st%.2ft%.2ft%.2ftt%.2ftt%.2fn,q-stuid,q-name,q-sum,q-average,q-english,q-ma
6、th,q-database);free(q); /qelseprintf(n);/elseprintf(:);scanf(%10d,&num);while(q-stuid!=num&q-next!=NULL)p=q;q=q-next;if(q-stuid=num) /q,pp-next=q-next;printf(:n);printf(ttttttn);printf(%dt%st%.2ft%.2ft%.2ftt%.2ftt%.2fn,q-stuid,q-name,q-sum,q-average,q-english,q-math,q-database);free(q); /qelseprintf
7、(n);/5.void Search(LinkList L)LinkList p;int num,ch;char sn20;p=L-next;if(!L)printf(n);elseprintf(1.n2.n:);scanf(%d,&ch);if(ch=1)printf(:n);scanf(%10d,&num);while(p&p-stuid!=num)p=p-next;if(p-stuid=num)printf(ttttttn);printf(%dt%st%.2ft%.2ft%.2ftt%.2ftt%.2fn,p-stuid,p-name,p-sum,p-average,p-english,
8、p-math,p-database);elseprintf(n);/ch=1elseprintf(:n);scanf(%s,sn);while(p&strcmp(p-name,sn)!=0)p=p-next;if(strcmp(p-name,sn)=0)printf(ttttttn);printf(%dt%st%.2ft%.2ft%.2ftt%.2ftt%.2fn,p-stuid,p-name,p-sum,p-average,p-english,p-math,p-database);elseprintf(n);/ch=2/6.void Max(LinkList L)LinkList p1=L-
9、next,p2=L-next,p3=L-next;float max1=0,max2=0,max3=0;printf( *n);printf( * *n);printf( *n);/for(p1;p1-next!=NULL;p1=p1-next)if(p1-englishp1-next-english)max1=p1-english;elsemax1=p1-next-english;/for(p2;p2-next!=NULL;p2=p2-next)if(p2-mathp2-next-math)max2=p2-math;elsemax2=p2-next-math;/for(p3;p3-next!
10、=NULL;p3=p3-next)if(p3-databasep3-next-database)max3=p3-database;elsemax3=p3-next-database;printf( :t%6.1fn,max1);printf( :t%6.1fn,max2);printf( :t%6.1fn,max3);/7.void Average(LinkList L)float ave1,ave2,ave3,i=0;float english1=0,math1=0,database1=0;LinkList p;p=L-next;if(!L)printf();while(p!=NULL)i+
11、;english1=english1+p-english;math1= math1+ p-math;database1=database1+ p-database;p=p-next;ave1=english1/i;ave2=math1/i;ave3=database1/i;printf(*n);printf( * *n);printf(*nn);printf(ttttn);printf(t:%6.1ft%6.1ft%6.1fn,ave1,ave2,ave3);/0.void tuichu()printf(t*n);exit(0);/8.void Sort(LinkList L)LinkList
12、 p,q,r;int ch1,ch2,dd1,i,j,count=0;float dd2;if(!L)printf();elseprintf(1.t2.t3.n);scanf(%d,&ch1);switch (ch1)case 1:/Lprintf(1.n2.t3.n4.t5.n);scanf(%d,&ch2);switch (ch2)case 1:p=L-next-next;/pL-next-next=NULL;/while(p!=NULL)r=p-next;/pq=L;while(q-next!=NULL&q-next-stuidstuid)/q=q-next;/Pp-next=q-nex
13、t;q-next=p;p=r;break;case 2:p=L-next-next;L-next-next=NULL;while(p!=NULL)r=p-next;q=L;while(q-next!=NULL&q-next-englishenglish)q=q-next;p-next=q-next;q-next=p;p=r;break;case 3:p=L-next-next;L-next-next=NULL;while(p!=NULL)r=p-next;q=L;while(q-next!=NULL&q-next-mathmath)q=q-next;p-next=q-next;q-next=p
14、;p=r;break;case 4:p=L-next-next;L-next-next=NULL;while(p!=NULL)r=p-next;q=L;while(q-next!=NULL&q-next-databasedatabase)q=q-next;p-next=q-next;q-next=p;p=r;break;case 5:p=L-next-next;L-next-next=NULL;while(p!=NULL)r=p-next;q=L;while(q-next!=NULL&q-next-sumsum)q=q-next;p-next=q-next;q-next=p;p=r;break
15、;/switch(ch2)break;case 2:p=L-next;while(p)count+;p=p-next;printf(1.n2.t3.n4.t5.n);scanf(%d,&ch2);switch (ch2)case 1:for(i=0;inext;for(j=0;jstuidp-next-stuid)dd1=p-stuid;p-stuid=p-next-stuid;p-next-stuid=dd1;p=p-next;break;case 2:for(i=0;inext;for(j=0;jenglishp-next-english)dd2=p-english;p-english=p
16、-next-english;p-next-english=dd2;p=p-next;break;case 3:for(i=0;inext;for(j=0;jmathp-next-math)dd2=p-math;p-math=p-next-math;p-next-math=dd2;p=p-next;break;case 4:for(i=0;inext;for(j=0;jdatabasep-next-database)dd2=p-database;p-database=p-next-database;p-next-database=dd2;p=p-next;break;case 5:for(i=0
17、;inext;for(j=0;jsump-next-sum)dd2=p-sum;p-sum=p-next-sum;p-next-sum=dd2;p=p-next;break;/switch(ch2)break;case 3:/p=L-next;printf(1.n2.t3.n4.t5.n);scanf(%d,&ch2);switch (ch2)case 1:while(p)q=p-next;r=p;/rwhile(q)if(q-stuidstuid)r=q;q=q-next;if(r!=p)dd1=r-stuid;r-stuid=q-stuid;q-stuid=dd1;p=p-next;/wh
18、ile(p)break;case 2:while(p)q=p-next;r=p;/rwhile(q)if(q-englishenglish)r=q;q=q-next;if(r!=p)dd2=r-english;r-english=q-english;q-english=dd2;p=p-next;/while(p)break;case 3:while(p)q=p-next;r=p;/rwhile(q)if(q-mathmath)r=q;q=q-next;if(r!=p)dd2=r-math;r-math=q-math;q-math=dd2;p=p-next;/while(p)break;case 4:while(p)q=p-next;r=p;/rwhile(q)if(q-databasedatabase)r=q;q=q-next;if(r!=p)dd2=r-database;r-database=q-database;q-database=dd2;p=p-next;/while(p)break;cas
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 七项工作制度
- 传习工作制度
- 丘吉尔工作制度
- 勘探工作制度
- 人流工作制度
- 卸载站工作制度
- 住院处工作制度
- 专家库工作制度
- 儿心量工作制度
- 优生工作制度
- 违纪违法反面典型案例剖析材料汇编3篇
- 黄金冶炼项目可行性研究报告
- 胆囊癌完整版本
- 第15课《十月革命与苏联社会主义建设》中职高一下学期高教版(2023)世界历史全一册
- 十期牛黄清心丸
- 缠论-简单就是美
- JT-T-798-2019路用废胎胶粉橡胶沥青
- 手术室应对特殊感染手术的应急预案
- 2.1科学探究感应电流的方向课件-高二物理(2019选择性)
- (正式版)JBT 14793-2024 内燃机质量评价规范
- GB/T 42793-2024航空用铝合金板材通用技术规范
评论
0/150
提交评论