资源描述:
《C语言学生管理系统源代码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、C语言学生成绩管理系统源代码,保证能用……#include"malloc.h"#include"stdio.h"#include"stdlib.h"#include"string.h"charfilename[30];intn=0,d;FILEfp;typedefstructstudent{intnum;charname[10];intyuwen;intshuxue;intyingyu;intcount;floataver;structstudentnext;}aaa;typedefstructstu{intnum;charname[10];intyuwen,shuxue,y
2、ingyu;intcount;floataver;}aaaa;aaahead;/浏览/voidliulan(aaahead){aaap;if(head==NULL)printf("没有任何学生资料!");else{printf("ttt考试成绩管理系统");printf("----------------------------------------------------");printf("学号t姓名t语文t数学t英语t总分t平均分");printf("----------------------------------------
3、------------");p=head->next;do{printf("%dt%st%dt%dt%dt%dt%.1ft",p->num,p->name,p->yuwen,p->shuxue,p->yingyu,p->yuwen+p->shuxue+p->yingyu,p->count/3.0);printf("----------------------------------------------------");p=p->next;}while(p!=NULL);}}/读取/aaaduqu(){aaas,head,p,q;n=0;if((
4、fp=fopen(filename,"rb"))==NULL){printf("不能读取文件!");returnNULL;}head=malloc(sizeof(aaa));if(head==NULL){printf("内存空间不足,文件读取失败!");returnNULL;}head->next=NULL;p=head;q=malloc(sizeof(aaa));if(!feof(fp)){fread(q,sizeof(aaaa),1,fp);q->next=NULL;}while(!feof(fp)){s=malloc(sizeof(aaa));fread(s,s
5、izeof(aaaa),1,fp);s->next=NULL;p->next=q;p=q;q=s;n++;}returnhead;}/输入函数/aaashuru(aaahead){aaaq,p,s;aaanewstd;n=0;q=head;do{q=head;s=malloc(sizeof(aaa));if(s==NULL){printf("内存不足,添加学生成绩失败! 7");break;}printf("请输入学号(输入0退出):");scanf("%d",&newstd.num);if(newstd.num==0)break;if(newstd.num<0){pr
6、intf("输入学号有误,请重新输入");break;}p=head->next;while(p!=NULL){if(p->num==newstd.num){printf("输入学号重复,请重新输入!");break;}p=p->next;q=q->next;}if(p==NULL){printf("姓名:");scanf("%s",newstd.name);printf("语文:");scanf("%d",&newstd.yuwen);printf("数学:");scanf("%d",&newstd.shuxue);printf("英语:");scanf("%d",
7、&newstd.yingyu);strcpy(s->name,newstd.name);s->num=newstd.num;s->yuwen=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个