C语言写的学生成绩管理系统_第1页
C语言写的学生成绩管理系统_第2页
C语言写的学生成绩管理系统_第3页
全文预览已结束

下载本文档

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

文档简介

1、#include<stdio.h>#include<string.h>#include<stdlib.h>structstud(longnum;charname20;floatsx;floatdx;floatts;floatdl;floatcx;floatzf;floatpj;structstudcode(structstudstudent;structstudcode*next;voidmenu();voidinput(structstudcode*);voidoutput(structstudcode*);voidbinsearch(structstud

2、code*);voidinsert(structstudcode*);voiddelet(structstudcode*);voidgood(structstudcode*);voidfail(structstudcode*);voidsort(structstudcode*);voidback();voidmain()(charchoose;intflag=1;structstudcode*head;head=NULL;printf("请先录入学生成绩彳息n");printf("输入学生学号高数、英语读写、英语听说、计算机导论和程序设计的成绩n");i

3、nput(&head);while(flag)system("cls");menu();printf("请选择:");getchar();choose=getchar();switch(choose)(case'1':output(head);back();break;case'2':binsearch(head);back();break;case'3':insert(&head);output(head);back();break;case'4':delet(&h

4、ead);output(head);back();break;case'5':good(head);back();break;case'6':fail(head);back();break;case'7':sort(head);output(head);back();break;case'0':flag=0;printf("n*TheEnd!*n");printf("n#感使用,欢迎再次登录,拜拜!#n");(选择错误,请重选)n")break;default:printf(&qu

5、ot;nWrongSelectionback();voidmenu()printf("n学生成绩统计与分析系统n");printf("n菜单nn");printf("n1.显示所有学生的信息n");printf("n2.查找某学号的学生信息n");printf("n3.插入某学生的信息n");printf("n4.删除某学号学生的信息n");printf("n5.统计各门课程成绩在90分以上学生所占百分比printf("n6.统计各门课程成绩在60分以下学

6、生所占百分比printf("n7.按总分降序排序,依高低排出名次n");printf("n0.退出nn");n");n");voidback()intx;printf("n");doprintf(-按1返回菜单界面:");scanf("%d”,&x);while(x!=1);voidinput(structstudcode*headp)structstudcode*p;while(1)p=(structstudcode*)malloc(sizeof(structstudcode);sca

7、nf("%ld”,&p->student.num);if(p->student.num=0)break;scanf("%s%f%f%f%f%f",&p->,&p->student.sx,&p->student.dx,&p->student.ts,&p->student.dl,&p->student.cx);p->student.zf=p->student.sx+p->student.dx+p->student.ts

8、+p->student.dl+p->student.cx;p->student.pj=p->student.zf/5;p->next=*headp;*headp=p;voidoutput(structstudcode*head)structstudcode*p;p=head;printf("学号tt高数t读写t听说t导论t程序t总分t平均分n");while(p!=NULL)n",p->student.num,p->,p->student.sx,p->student.dx,p->s

9、tudent.ts,p->student.dl,p->student.cx,p->student.zf,p->student.pj);p=p->next;printf("n");voidbinsearch(structstudcode*head)structstudcode*p;intk=1;longx;p=head;printf(-请输入需要查找的学生的学号:");scanf("%ld",&x);printf("n");while(p!=NULL)if(p->student.nu

10、m=x)printf("该学生信息如下:n");printf("学号tt高数t读写t听说t导论t程序t总分t平均分n");printf("%-ldt%-4st%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2fn",p->student.num,p->,p->student.sx,p->student.dx,p->student.ts,p->student.dl,p->student.cx,p->student.zf,p

11、->student.pj);k=0;break;p=p->next;if(k)printf(-没有此学生的信息n");voidinsert(structstudcode*headp)structstudcode*p;p=(structstudcode*)malloc(sizeof(structstudcode);printf("请输入你想插入的学生的信息n");scanf("%ld%s%f%f%f%f%f",&p->student.num,&p->,&p->stude

12、nt.sx,&p->student.dx,&p->student.ts,&p->student.dl,&p->student.cx);p->student.zf=p->student.sx+p->student.dx+p->student.ts+p->student.dl+p->student.cx;p->student.pj=p->student.zf/5;p->next=*headp;*headp=p;printf("*插入成功*n");voiddelet(st

13、ructstudcode*headp)structstudcode*p,*last;longx;p=*headp;printf("请输入你要删除的学生的学号:");scanf("%ld",&x);while(p->student.num!=x&&p->next!=NULL)last=p;p=p->next;if(p->student.num=x)if(p=*headp)*headp=p->next;elselast->next=p->next;free(p);printf("n*

14、删除成功*n");elseprintf("n*删除失败,无该学生信息*n");voidgood(structstudcode*head)(structstudcode*p;intx1,x2,x3,x4,x5,k;floaty1,y2,y3,y4,y5;x1=x2=x3=x4=x5=k=0;p=head;while(p!=NULL)k+;if(p->student.sx>=90)x1+;if(p->student.dx>=90)x2+;if(p->student.ts>=90)x3+;if(p->student.dl>

15、=90)x4+;if(p->student.cx>=90)x5+;p=p->next;y1=(float)x1/k;y2=(float)x2/k;y3=(float)x3/k;y4=(float)x4/k;y5=(float)x5/k;printf("高数t读写t听说t导论t程序n");printf("%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2fn”,y1,y2,y3,y4,y5);voidfail(structstudcode*head)structstudcode*p;intx1,x2,x3,x4,x5,k;float

16、y1,y2,y3,y4,y5;x1=x2=x3=x4=x5=k=0;p=head;while(p!=NULL)k+;if(p->student.sx<60)x1+;if(p->student.dx<60)x2+;if(p->student.ts<60)x3+;if(p->student.dl<60)x4+;if(p->student.cx<60)x5+;p=p->next;y1=(float)x1/k;y2=(float)x2/k;y3=(float)x3/k;y4=(float)x4/k;y5=(float)x5/k;printf("高数t读写t听说t导论t程序n");printf("%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2fn",y1,y2,y3,y4,y5);voidsort(structstudcode*head)structstudtemp;inti,j,n;structstudcode*p,*p1,*p2;n=0;p=head;wh

温馨提示

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

评论

0/150

提交评论