C语言学生成绩管理系统源代码,保证能用……
#includemalloc,h
#includestdio.h
#includestdlib.h
#includestring.h
charfilename[30];
intn=0,d;
FILE*fp;
typedefstructstudent
intnum;
charname[10];
intyuwen;
intshuxue;
intyingyu;
intcount;
floataver:
structstudent*next;
!aaa;
typedefstructstu
intnum;
charname[10];
intyuwen,shuxue.yingyu:
intcount;
floataver;
)aaaa;
aaa*head;
/*浏览*
voidliulan(aaa*head)
aaa*p;
if(head=NULL)
printf(n没有任何学生资料!\n);
else
(
printfttt考试成绩管理系统\n)
printf(…………\n);
printf(学号u|姓名\语文t数学\t英语t总分u平均分ln);
printf(…………\n);
p=head-next;
do{
printfdtst|%d\t%dt%dt%dt%.Ift|n,p-num.p-name,p-yuwen,p-
shuxue,p-yingyu,p-yuwen+p-shuxue+p-yingyu,p-count/3.0);
p=p-next;
|while(p!=NULL):
重
/*读取*/
aaa*duqu)
aaa*s,*head,*p,*q;
n=0;
if((fp=fopen(filename,rb))=NULL)
printf(不能读取文件!\n);
returnNULL;
head=malloc(sizeof(aaa));
if(head=NULL)
printf(内存空间不足,文件读取失败!\n);
returnNULL;
head-next=NULL;
p=head:
q-malloc(sizeof(aaa));
if(lfeoftfp))
fread(q,sizeof(anaa),I,fp);
q-next=NULL;
while(!fcof(fp))
s=malloc(sizeof(aaa));
fread(s,sizeof(aaaa),1,fp);
s-next=NULL;
p-next=q;
p=q;
q=s;
n++;
returnhead;
/*输入函数*/
aaa*shuru(aaa*head)
aaanewstd;
n=0;
q=head;
do{
q=head;
s=malloc(sizeof(aaa));
if(s=NULL)
printf(内存不足,添加学生成绩失败!07\n);
break;
printf(请输入学号(输入0退出):);
scanf(%d,newstd.num);
if(newstd.num—0)
break;
iftnewstd.num0)
printf(输入学号有误,请重新输入n);
break;
p=head-next;
while(p!=NULL)
if(p-num==newstd.num)
printf输入学号重复,请重新输入!\n);
break;
p=p-next;
q=q-next;
if(p=NULL)
printf(姓名:);
scanf(%s,);
printf”语文:);
scanf(%d,newstd.yuwen);
printf(数学:);
scanf(%d,newstd.shuxue);
printf(英语:);
scanft%d,newstd.yingyu);
strcpy(s-name,);
s-num=newstd.num;
1
syuwen=newstd.yuwen;
s-shuxue=newstd.shuxue;
s-yingyu=newstd.yingyu;
s-count=s-yuwen+s-shuxue+s-yingyu;
s-aver=(float)(s-count/3.0);
s-next=NULL;
q-next=s;
n++;
!
|while(1);
printf(输入完毕,%d个学生成绩已输入(已插入)\n,n):
returnhead;
;
/*保存/
intbaocun(aaa*head)
{
aaa*s
您可能关注的文档
- [八年级数学]北京市西城区(北区)2012-2013学年八年级上学期期末考试数学试题.docx
- 《供应链管理》课程教案.docx
- 《家具设计》第五章家具结构设计(第2节家具的接合方式及第3节木家具基本构件的结构)).docx
- 《家具设计》第五章家具结构设计(第2节家具的接合方式及第3节木家具基本构件的结构).docx
- 《中国法制史》辅修笔记.docx
- 2008年华南农业大学期末考试试卷a卷.docx
- 2011年秋季学期工程力学期末考试试卷a卷(答案).docx
- 2015年10月自考计算机网络原理(04741)试题及答案.docx
- 2019-2020学年北京市西城区八年级下学期期末数学试卷(解析版).docx
- 2021施工现场各类人员安全知识考核试卷.docx
原创力文档

文档评论(0)