欢迎来到天天文库
浏览记录
ID:61426796
大小:17.50 KB
页数:6页
时间:2021-01-29
《用C语言写的学生信息管理系统+自己写的.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、#include#includestructstudent{intnum;charname[20];inty;ints;intd;intz;intbz;};structstudentstu[1000];intn=0;voidred();voidf1();voidf2();voidf3();voidf4();voidsav();voidmain(){FILE*fp; if((fp=fopen("student","r"))==NULL){
2、fclose(fp); FILE*fp; fp=fopen("student","w"); fclose(fp);} red(); inti;loop1: printf("************************************************ 1 查询每科最高分的学生 2 查询所有学生 3 删除信息 4 添加信息其它 退出保存******************************************
3、******"); scanf("%d",&i); switch(i){ case1: f1(); goto loop1; case2: f2(); goto loop1; sav(); case3: f3(); goto loop1; case4: f4(); goto loop1; default: sav();
4、 }printf("操作已保存");}voidred(){inti;FILE*fp;fp=fopen("student","r");for(i=0;!feof(fp);i++){ fread(&stu[i],sizeof(structstudent),1,fp); n=i+1;}fclose(fp);}voidf1(){ inti; printf("************************************************1语文2数学3代数
5、************************************************"); scanf("%d",&i); switch(i){ case1: { intj; structstudentst; st.y=0; for(j=0;jst.y)st=stu[j]
6、; printf("语文最高分的学生:"); if(stu[i].bz) { printf(" 学号 姓名 语文 数学 代数 总分"); printf("%8d%10s%8d%8d%8d%8d",st.num,st.name,st.y,st.s,st.d,st.z); } break; } case2: { intj; s
7、tructstudentst; st.s=0; for(j=0;jst.s)st=stu[j]; printf("数学最高分的学生:"); if(stu[i].bz) { printf(" 学号 姓名 语文 数学 代数 总分"); printf("%8d%10s
8、%8d%8d%8d%8d",st.num,st.name,st.y,st.s,st.d,st.z); } break; } case3: { intj; structstudentst; st.d=0; for(j=0;jst.d)st=stu[j]; printf("代数最高分的学生:
此文档下载收益归作者所有