欢迎来到天天文库
浏览记录
ID:55279420
大小:40.50 KB
页数:13页
时间:2020-05-08
《学生信息管理系统 C语言.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include"stdio.h"#include"string.h"#include"stdlib.h"#defineM10intnum;//计数structstudent{charxuehao[10];//学号charname[10];//姓名charsex[8];//性别charbirth[20];//出生年月charjiguan[30];//籍贯chartel[30];//电话intscore;//成绩}student[M];charheadline[80];//全局变量voidread1(){FILE*fp
2、;//文件指针inti=0;fp=fopen("jz0112.txt","r");//打开文件if(fp==NULL){printf("不能找到文件,请检查!");return;}fgets(headline,80,fp);//读第一行的函数puts(headline);while(!feof(fp))//判断文件是否结束//for(i=0;i3、udent[i].birth,student[i].jiguan,student[i].tel,&student[i].score);i++;//fscanf读两个空白字符之间的字符}num=i;fclose(fp);//关闭文件for(i=0;i4、nt[i].tel,student[i].score);}voidfind_xuehao()//按学号查询{charxuehao[10];inti;intflag=0;printf("请输入学号:");scanf("%s",xuehao);for(i=0;i5、dent[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);break;}if(flag==0)printf("无此信息");}voidfind_name()//按姓名查询{charname[8];inti;intflag=0;printf("请输入姓名:");scanf("%s",name);for(i=0;i6、1;printf("%-10s%-8s%6s%16s%16s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);break;}if(flag==0)printf("无此信息");}voidall()//显示全部{inti;for(i=0;i7、s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);}}voidfind(){intb;printf("*************************************************************************");printf("1按学号查询2按姓名查询3显示全部48、退出");printf("*************************************************************************");printf("请选择:");scanf("%d",&b);switch(b){case1:find_xuehao();break;case2:find_n
3、udent[i].birth,student[i].jiguan,student[i].tel,&student[i].score);i++;//fscanf读两个空白字符之间的字符}num=i;fclose(fp);//关闭文件for(i=0;i4、nt[i].tel,student[i].score);}voidfind_xuehao()//按学号查询{charxuehao[10];inti;intflag=0;printf("请输入学号:");scanf("%s",xuehao);for(i=0;i5、dent[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);break;}if(flag==0)printf("无此信息");}voidfind_name()//按姓名查询{charname[8];inti;intflag=0;printf("请输入姓名:");scanf("%s",name);for(i=0;i6、1;printf("%-10s%-8s%6s%16s%16s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);break;}if(flag==0)printf("无此信息");}voidall()//显示全部{inti;for(i=0;i7、s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);}}voidfind(){intb;printf("*************************************************************************");printf("1按学号查询2按姓名查询3显示全部48、退出");printf("*************************************************************************");printf("请选择:");scanf("%d",&b);switch(b){case1:find_xuehao();break;case2:find_n
4、nt[i].tel,student[i].score);}voidfind_xuehao()//按学号查询{charxuehao[10];inti;intflag=0;printf("请输入学号:");scanf("%s",xuehao);for(i=0;i5、dent[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);break;}if(flag==0)printf("无此信息");}voidfind_name()//按姓名查询{charname[8];inti;intflag=0;printf("请输入姓名:");scanf("%s",name);for(i=0;i6、1;printf("%-10s%-8s%6s%16s%16s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);break;}if(flag==0)printf("无此信息");}voidall()//显示全部{inti;for(i=0;i7、s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);}}voidfind(){intb;printf("*************************************************************************");printf("1按学号查询2按姓名查询3显示全部48、退出");printf("*************************************************************************");printf("请选择:");scanf("%d",&b);switch(b){case1:find_xuehao();break;case2:find_n
5、dent[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);break;}if(flag==0)printf("无此信息");}voidfind_name()//按姓名查询{charname[8];inti;intflag=0;printf("请输入姓名:");scanf("%s",name);for(i=0;i6、1;printf("%-10s%-8s%6s%16s%16s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);break;}if(flag==0)printf("无此信息");}voidall()//显示全部{inti;for(i=0;i7、s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);}}voidfind(){intb;printf("*************************************************************************");printf("1按学号查询2按姓名查询3显示全部48、退出");printf("*************************************************************************");printf("请选择:");scanf("%d",&b);switch(b){case1:find_xuehao();break;case2:find_n
6、1;printf("%-10s%-8s%6s%16s%16s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);break;}if(flag==0)printf("无此信息");}voidall()//显示全部{inti;for(i=0;i7、s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);}}voidfind(){intb;printf("*************************************************************************");printf("1按学号查询2按姓名查询3显示全部48、退出");printf("*************************************************************************");printf("请选择:");scanf("%d",&b);switch(b){case1:find_xuehao();break;case2:find_n
7、s%16s%6d",student[i].xuehao,student[i].name,student[i].sex,student[i].birth,student[i].jiguan,student[i].tel,student[i].score);}}voidfind(){intb;printf("*************************************************************************");printf("1按学号查询2按姓名查询3显示全部4
8、退出");printf("*************************************************************************");printf("请选择:");scanf("%d",&b);switch(b){case1:find_xuehao();break;case2:find_n
此文档下载收益归作者所有