c语言学生成绩管理系统代码

c语言学生成绩管理系统代码

ID:15031977

大小:55.00 KB

页数:19页

时间:2018-08-01

c语言学生成绩管理系统代码_第1页
c语言学生成绩管理系统代码_第2页
c语言学生成绩管理系统代码_第3页
c语言学生成绩管理系统代码_第4页
c语言学生成绩管理系统代码_第5页
资源描述:

《c语言学生成绩管理系统代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、c语言学生成绩管理系统代码#include#include#include#defineLENsizeof(structstu)intnum=0;structstu{charname[20];charsex[20];charcla[20];charnumber[20];intc1;intc2;intc3;floatave;floatall;structstu*next;}student;structstu*head,*pf,*pb;//求总成绩floatAll(structstu*student){

2、returnstudent->c1+student->c2+student->c3;}//求平均成绩floatAve(structstu*student){return(student->c1+student->c2+student->c3)/3;}//建立链表structstu*creat(){charnumstr[20],k;FILE*fp;if((fp=fopen("d:\wenjian.txt","ab"))==NULL){printf("ttt不能打开文件");exit(1);}while(1){pb=(structstu*)ma

3、lloc(LEN);printf("ttt输入姓名:");gets(pb->name);printf("ttt输入系别:");gets(pb->sex);printf("ttt输入班级:");gets(pb->cla);printf("ttt输入学号:");gets(pb->number);printf("ttt输入成绩1:");gets(numstr);pb->c1=atol(numstr);printf("ttt输入成绩2:");gets(numstr);pb->c2=atol(numstr);printf("t

4、tt输入成绩3:");gets(numstr);pb->c3=atol(numstr);pb->ave=Ave(pb);pb->all=All(pb);if(num==0)head=pf=pb;elsepf->next=pb;pb->next=NULL;pf=pb;fwrite(pb,LEN,1,fp);printf("ttt是否继续?(n/y)");scanf("%c",&k);getchar();num++;if(k=='n')break;elsecontinue;}fclose(fp);return(head);}//按姓名查找学生voidf

5、ind(){structstu*p,*head;FILE*fp;intz=0;charf_name[20];if((fp=fopen("d:\wenjian.txt","rb"))==NULL){printf("ttt没有数据");exit(1);}printf("ttt输入要查找的学生姓名:");scanf("%s",f_name);while(fread(&student,LEN,1,fp)==1){if(strcmp(student.name,f_name)==0){printf("-----------------------

6、--------------------------------------------------------");printf("名字=%s,系别=%s,班级=%s,学号=%s,成绩1=%d,成绩2=%d,成绩3=%d,平均成绩=%.2lf,总成绩=%.2lf",student.name,student.sex,student.cla,student.number,student.c1,student.c2,student.c3,student.ave,student.all);printf("-------------------------

7、------------------------------------------------------");z=1;break;}}fclose(fp);if(z==0)printf("ttt该学生不存在");}//按学号查找voidfindnum(){structstu*p,*head;FILE*fp;intz=0;charf_num[20];if((fp=fopen("d:\wenjian.txt","rb"))==NULL){printf("ttt没有数据");exit(1);}printf("ttt输入

8、要查找的学生学号:");scanf("%s",f_num);whi

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。