资源描述:
《c语言学生信息管理系统》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include/*I/O函数*/#include/*其它说明*/#include/*字符串函数*/#include#include#include#defineMaxPwdLen20/*密码最大长度*/#defineN50/*最大学生人数,实际请更改*/structstudent{intno;/*学号*/charname[20];/*名字*/charsex;/*性别*/intscore[3];/*成绩*/intsum;/*总成绩*/floataverage;/*
2、平均成绩*/}stu[];//函数声明voidSaveStu(structstudentstu[],intcount,intflag);//保存数据,写入文件voidLoadStu(structstudentstu[],int*stu_number);//读取文件数据voidPassWord();//密码验证voidMenu();//显示主菜单voidInputStu(structstudentstu[],int*stu_number);//输入学生记录voidBrowseStu(structstudentstu[],int*stu_number);//浏览学生记录voi
3、dSortStu(structstudentstu[],int*stu_number);//排序学生记录voidSearchStu(structstudentstu[],int*stu_number);//查找学生记录voidDeleteStu(structstudentstu[],int*stu_number);//删除学生记录voidModifyStu(structstudentstu[],int*stu_number);//修改学生记录voidCountScore(structstudentstu[],int*stu_number);//统计学生记录main(){s
4、tructstudentstu[N];intstu_number=0;intchoose,flag=1;PassWord();while(flag){system("cls");Menu();printf("tt请选择主菜单序号(0-7):");scanf("%d",&choose);switch(choose){case1:InputStu(stu,&stu_number);break;case2:BrowseStu(stu,&stu_number);break;case3:SearchStu(stu,&stu_number);break;case4:SortStu
5、(stu,&stu_number);break;case5:DeleteStu(stu,&stu_number);break;case6:ModifyStu(stu,&stu_number);break;case7:CountScore(stu,&stu_number);break;case0:flag=0;}}}//========================================//functionname:SaveStu//description:保存数据,写入文件//inputparameters:structstudentstu,intcount,
6、intflag//returnvalue:none//author:王学斌//date://========================================voidSaveStu(structstudentstu[],intcount,intflag){FILE*fp;inti;if((fp=flag?fopen("list.dat","ab"):fopen("list.dat","wb"))==NULL){printf("不能打开文件");return;}for(i=0;i7、uctstudent),1,fp)!=1)printf("文件写错误");fclose(fp);}//==============================================//functionname:LoadStu//description:读取文件数据stu中//inputparameters:structstudentstu,int*stu_number//returnvalue:none//author:王学斌//date://=================================