资源描述:
《学生成绩管理系统源代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#include#defineM50structstudent{charname[15];charnum[10];charsex[3];intscore[6];}s[M];//录入基本信息voidinputBas(){inti,n;FILE*f;printf("请输入待录入的学生个数:");scanf("%d",&n);f=fopen("BasicInformation.txt","w+");for(i=0;i2、",i+1);scanf("%s",s[i].name);printf("请输入第%d个学生的学号:",i+1);scanf("%s",s[i].num);printf("请输入第%d个学生的性别:",i+1);scanf("%s",s[i].sex);if(fwrite(&s[i],sizeof(structstudent),1,f)!=1){printf("FileBasicInformation.txtwriteerror");return;}}fclose(f);}//修改基本信息voidmodifyBas()
3、{intm=-1,k;charna[15],nu[10],se[3],n[10];FILE*fp,*f;fp=fopen("BasicInformation.txt","r");if((fp=fopen("BasicInformation.txt","r"))==NULL){printf("找不到文件!");exit(0);}printf("请输入要修改的学生学号:");scanf("%s",n);for(inti=0;i4、].sex);if(strcmp(s[i].num,n)==0)m=i;}fclose(fp);if(m==-1){printf("该学号不存在!!!");return;}printf("1:修改姓名");printf("2:修改学号");printf("3:修改性别");dprintf("4:退出修改");printf("请选择菜单编号:");scanf("%d",&k);f=fopen("BasicInformation.txt","w");switch(k){case1:{printf("
5、请输入新姓名:");scanf("%s",na);strcpy(s[m].name,na);break;}case2:{printf("请输入新学号:");scanf("%s",nu);strcpy(s[m].num,nu);break;}case3:{printf("请输入新性别:");scanf("%s",se);strcpy(s[m].sex,se);break;}case4:break;default:printf("请在1-4中选择!");break;}for(i=0;i6、i],sizeof(structstudent),1,f)!=1){printf("FileBasicInformation.txtwriteerror");return;}}fclose(f);}//删除函数voiddelstudent(){inti,m=-1,k=0;charn[10];FILE*fp,*f,*f1,*p1;fp=fopen("BasicInformation.txt","r");if((fp=fopen("BasicInformation.txt","r"))==NULL){printf("找不到
7、文件!");exit(0);}printf("请输入要删除学生的学号:");scanf("%s",n);for(i=0;i