欢迎来到天天文库
浏览记录
ID:19621605
大小:46.50 KB
页数:16页
时间:2018-10-04
《成绩管理系统88329》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、成绩管理系统88329#include"stdio.h"#include"stdlib.h"#include"conio.h"#include"dos.h"#include"string.h"#defineLENsizeof(structstudent)#defineFORMAT"%d%s"voidmenu();voidprint(structstudent*);voidin();voidshow();voidsearch();voidmodify();voiddel();voidinsert();v
2、oidorder();structstudent{intnum;charname[15];floatscore[8];floatsum;floatavr;};structstudentstu[50];voidmenu(){system("cls");printf("");printf("ttt
3、--------成绩管理系统-------
4、");printf("ttt
5、1.inputrecord
6、");printf("ttt
7、2.showrecord
8、");pr
9、intf("ttt
10、3.searchrecord
11、");printf("ttt
12、4.modifyrecord
13、");printf("ttt
14、5.insertrecord
15、");printf("ttt
16、6.deleterecord
17、");printf("ttt
18、7.order
19、");printf("ttt
20、0.exit
21、");printf("ttt
22、---------------------------
23、");printf("tt
24、tchoose(0-7):");}voidprint(structstudent*p){printf(FORMAT,p->num,p->name);printf("");}voidshow(){FILE*fp;inti,j,m=0;fp=fopen("data.txt","r");while(!feof(fp)){if(fread(&stu[m],LEN,1,fp)==1)m++;}fclose(fp);printf("学号姓名英语数学数据体育语文物理毛概近代总分平均分");for(i=0;
25、i26、e(!feof(fp)){if(fread(&stu[m],LEN,1,fp)==1)m++;}fclose(fp);if(m==0)printf("norecord!");else{system("cls");show();}if((fp=fopen("data.txt","w"))==NULL){printf("cannotopen!");return;}for(i=0;i27、;scanf("%s",ch);while(strcmp(ch,"Y")==028、29、strcmp(ch,"y")==0){printf("number:");scanf("%d",&stu[i].num);for(i=0;i30、j<8;j++){printf("thescore%d",(j+1));scanf("%f",&stu[m].score[j]);stu[m].sum+=stu[m].score[j];}stu[m].avr=stu[m].sum/8;if(fwrite(&stu[m],LEN,1,fp)!=1){printf("cannotsave!");getch();}else{printf("%ssaved!",stu[m].name);m++;}printf(
26、e(!feof(fp)){if(fread(&stu[m],LEN,1,fp)==1)m++;}fclose(fp);if(m==0)printf("norecord!");else{system("cls");show();}if((fp=fopen("data.txt","w"))==NULL){printf("cannotopen!");return;}for(i=0;i27、;scanf("%s",ch);while(strcmp(ch,"Y")==028、29、strcmp(ch,"y")==0){printf("number:");scanf("%d",&stu[i].num);for(i=0;i30、j<8;j++){printf("thescore%d",(j+1));scanf("%f",&stu[m].score[j]);stu[m].sum+=stu[m].score[j];}stu[m].avr=stu[m].sum/8;if(fwrite(&stu[m],LEN,1,fp)!=1){printf("cannotsave!");getch();}else{printf("%ssaved!",stu[m].name);m++;}printf(
27、;scanf("%s",ch);while(strcmp(ch,"Y")==0
28、
29、strcmp(ch,"y")==0){printf("number:");scanf("%d",&stu[i].num);for(i=0;i30、j<8;j++){printf("thescore%d",(j+1));scanf("%f",&stu[m].score[j]);stu[m].sum+=stu[m].score[j];}stu[m].avr=stu[m].sum/8;if(fwrite(&stu[m],LEN,1,fp)!=1){printf("cannotsave!");getch();}else{printf("%ssaved!",stu[m].name);m++;}printf(
30、j<8;j++){printf("thescore%d",(j+1));scanf("%f",&stu[m].score[j]);stu[m].sum+=stu[m].score[j];}stu[m].avr=stu[m].sum/8;if(fwrite(&stu[m],LEN,1,fp)!=1){printf("cannotsave!");getch();}else{printf("%ssaved!",stu[m].name);m++;}printf(
此文档下载收益归作者所有