C语言写的学生成绩管理系统链表.docx

上传人:b****3 文档编号:551117 上传时间:2022-10-11 格式:DOCX 页数:10 大小:15.85KB
下载 相关 举报
C语言写的学生成绩管理系统链表.docx_第1页
第1页 / 共10页
C语言写的学生成绩管理系统链表.docx_第2页
第2页 / 共10页
C语言写的学生成绩管理系统链表.docx_第3页
第3页 / 共10页
C语言写的学生成绩管理系统链表.docx_第4页
第4页 / 共10页
C语言写的学生成绩管理系统链表.docx_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

C语言写的学生成绩管理系统链表.docx

《C语言写的学生成绩管理系统链表.docx》由会员分享,可在线阅读,更多相关《C语言写的学生成绩管理系统链表.docx(10页珍藏版)》请在冰豆网上搜索。

C语言写的学生成绩管理系统链表.docx

C语言写的学生成绩管理系统链表

 

C语言写的学生成绩管理系统链表

 

#include

#include

#include

structstud{

longnum;

charname[20];

floatsx;

floatdx;

floatts;

floatdl;

floatcx;

floatzf;

floatpj;

};

structstudcode{

structstudstudent;

structstudcode*next;

};

voidmenu();

voidinput(structstudcode**);

voidoutput(structstudcode*);

voidbinsearch(structstudcode*);

voidinsert(structstudcode**);

voiddelet(structstudcode**);

voidgood(structstudcode*);

voidfail(structstudcode*);

voidsort(structstudcode*);

voidback();

 

voidmain()

{

charchoose;

intflag=1;

structstudcode*head;

head=NULL;

printf("请先录入学生成绩信息\n");

printf("输入学生学号姓名高数、英语读写、英语听说、计算机导论和程序设计的成绩\n");

input(&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(&head);

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");

break;

default:

printf("\nWrongSelection!

(选择错误,请重选)\n");

back();

}

}

}

 

voidmenu()

{

printf("\n学生成绩统计与分析系统\n");

printf("\n菜单\n\n");

printf("\n1.显示所有学生的信息\n");

printf("\n2.查找某学号的学生信息\n");

printf("\n3.插入某学生的信息\n");

printf("\n4.删除某学号学生的信息\n");

printf("\n5.统计各门课程成绩在90分以上学生所占百分比\n");

printf("\n6.统计各门课程成绩在60分以下学生所占百分比\n");

printf("\n7.按总分降序排序,依高低排出名次\n");

printf("\n0.退出\n\n");

}

voidback()

{

intx;

printf("\n");

do{

printf("按1返回菜单界面:

");

scanf("%d",&x);

}while(x!

=1);

}

voidinput(structstudcode**headp)

{

structstudcode*p;

while

(1)

{

p=(structstudcode*)malloc(sizeof(structstudcode));

scanf("%ld",&p->student.num);

if(p->student.num==0)break;

scanf("%s%f%f%f%f%f",&p->student.name,&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+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("学号\t姓名\t高数\t读写\t听说\t导论\t程序\t总分\t平均分\n");

while(p!

=NULL){

printf("%-ld\t%-4s\t%-0.2f\t%-0.2f\t%-0.2f\t%-0.2f\t%-0.2f\t%-0.2f\t%-0.2f\n",p->student.num,p->student.name,p->student.sx,p->student.dx,p->student.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.num==x)

{

printf("该学生信息如下:

\n");

printf("学号\t姓名\t高数\t读写\t听说\t导论\t程序\t总分\t平均分\n");

printf("%-ld\t%-4s\t%-0.2f\t%-0.2f\t%-0.2f\t%-0.2f\t%-0.2f\t%-0.2f\t%-0.2f\n",p->student.num,p->student.name,p->student.sx,p->student.dx,p->student.ts,p->student.dl,p->student.cx,p->student.zf,p->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->student.name,&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+p->student.dl+p->student.cx;

p->student.pj=p->student.zf/5;

p->next=*headp;

*headp=p;

printf("*****插入成功*****\n");

}

 

voiddelet(structstudcode**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;

else

last->next=p->next;

free(p);

printf("\n*****删除成功*****\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>=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.2f\t%-0.2f\t%-0.2f\t%-0.2f\t%-0.2f\n",y1,y2,y3,y4,y5);

}

 

voidfail(structstudcode*head)

{

structstudcode*p;

intx1,x2,x3,x4,x5,k;

floaty1,y2,y3,y4,y5;

x1=x2=x3=x4=x5=k=0;

p=head;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 外语学习 > 日语学习

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1