学生成绩管理系统c语言代码供参考Word格式.docx

上传人:b****5 文档编号:19110608 上传时间:2023-01-03 格式:DOCX 页数:12 大小:17.04KB
下载 相关 举报
学生成绩管理系统c语言代码供参考Word格式.docx_第1页
第1页 / 共12页
学生成绩管理系统c语言代码供参考Word格式.docx_第2页
第2页 / 共12页
学生成绩管理系统c语言代码供参考Word格式.docx_第3页
第3页 / 共12页
学生成绩管理系统c语言代码供参考Word格式.docx_第4页
第4页 / 共12页
学生成绩管理系统c语言代码供参考Word格式.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

学生成绩管理系统c语言代码供参考Word格式.docx

《学生成绩管理系统c语言代码供参考Word格式.docx》由会员分享,可在线阅读,更多相关《学生成绩管理系统c语言代码供参考Word格式.docx(12页珍藏版)》请在冰豆网上搜索。

学生成绩管理系统c语言代码供参考Word格式.docx

if((p=(unit*)malloc(sizeof(unit)))==NULL)

{printf("

=>

初始化失败!

"

);

return0;

}

else

{p->

next=NULL;

p->

date.number=0;

//头结点存放学生人数

printf("

初始化成功!

\n"

returnp;

voidadd(unit*head)//增加学生

unit*p,*q;

intm,n=0;

q=head->

next;

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

请输入新生姓名!

gets(p->

date.name);

fflush(stdin);

请输入学号!

while(n==0)

scanf("

%d"

&

m);

if(q==NULL)n=1;

while(q)

if(q->

date.number==m)

printf("

你输入的学号与已有同学的学号相同,请重新输入!

q=head->

break;

q=q->

p->

date.number=m;

请输入性别!

date.sex);

请输入数学成绩\n"

scanf("

date.math=m;

请输入英语成绩\n"

date.eglish=m;

请输入c语言成绩\n"

date.clanguge=m;

date.average=(p->

date.math+p->

date.eglish+p->

date.clanguge);

head->

next=p;

next=q;

date.number++;

voiddeletion(unit*head)//删除一名学生

unit*p=head->

next,*q=head;

charN[10];

请输入你想删除的学生姓名!

gets(N);

if(p==NULL)

系统无学生可删除!

while(p)

if(strcmp(p->

date.name,N)==0)

q->

next=p->

head->

date.number--;

删除%s成功!

p->

free(p);

p=p->

q=q->

你要删除的学生不存在,删除失败!

intdisplay(unit*head)//显示学生信息

printf("

系统无学生!

******************************************************************************\n"

请选择你的操作!

\t\t\t1.显示所有\t2.按姓名查找\n\t\t\t3.按学号查找\t4.返回主菜单\n"

fflush(stdin);

switch(m)

case1:

printf("

\n=>

该系统拥有%d名学生!

\n\n"

head->

date.number);

p=head->

\t姓名\t学号\t性别\t数学\t英语\tc语言\t综合\n\n"

printf("

\t%s\t%d\t%s\t%d\t%d\t%d\t%d\n"

date.name,p->

date.number,p->

date.sex,p->

date.math,

p->

date.eglish,p->

date.clanguge,p->

date.average);

p=p->

case2:

请输入查找姓名!

gets(N);

fflush(stdin);

\t姓名\t学号\t性别\t数学\t英语\tc语言\t综合\n"

你要查的学生不存在!

case3:

请输入查找学号!

scanf("

if(p->

case4:

n=1;

return1;

intrange(unit*head)//排序

unit*p=head,*q=head->

intn,i,m=head->

date.number;

*******************************************************************************\n"

\t\t\t1.按学号\t2.按成绩\n\n"

请选择操作!

\n》"

n);

fflush(stdin);

if(q==NULL)

无学生可排序!

switch(n)

for(i=0;

i<

m;

i++)//按总分排序

p=head;

q=head->

while(q->

next)

if((q->

date.average)<

(q->

next->

date.average))

p->

next=q->

p=p->

q->

q=q->

=m;

i++)//按学号排序

date.number)>

date.number))

排序成功!

voidmenu()

\n*********************************主菜单***************************************\n"

\t\t\t1.新建系统\t2.添加学生\n\t\t\t3.删除学生\t4.查看信息\n\t\t\t5.排列顺序\t6.读取信息\n\t\t\t7.保存信息\t8.退出系统\n"

intsave(unit*head)//保存

FILE*fp;

p=head;

if((fp=fopen("

d:

\\学生"

"

wb+"

))==NULL)

保存失败!

{fwrite(&

(p->

date),sizeof(student),1,fp);

p=p->

保存成功!

fclose(fp);

unit*read()//读入系统学生信息

inti;

unit*p,*q,*head;

if((head=(unit*)malloc(sizeof(unit)))==NULL)

开辟空间失败!

exit

(1);

head->

q=head;

rb"

{printf("

fread(&

head->

i++)

读值失败!

q->

returnhead;

voidmain()

intm=0,n,i;

unit*head;

********************************************************************************\n\n"

\t\t\t*欢迎使用学生成绩管理系统*\n"

\n\t\t\t\t\t\t\t\t编译员:

吹吹风\n\n"

正在读取系统信息......\n"

if((head=read())==0)

是否新建?

\t\t\t是

(1)\t\t否

(2)\n"

i);

if(i==1)

head=build();

elseif(i==2)

exit

(1);

信息导入成功!

while(m==0)

menu();

head=build();

add(head);

deletion(head);

display(head);

case5:

range(head);

case6:

head=read();

if(head!

=0)printf("

读取存盘成功!

case7:

save(head);

case8:

m=1;

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

当前位置:首页 > 求职职场 > 简历

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

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