c语言学生管理系统源代码.docx

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

文档评论(0)

1亿VIP精品文档

相关文档