C++编写学生信息管理系统源代码.docx_第1页
C++编写学生信息管理系统源代码.docx_第2页
C++编写学生信息管理系统源代码.docx_第3页
C++编写学生信息管理系统源代码.docx_第4页
C++编写学生信息管理系统源代码.docx_第5页
免费预览已结束,剩余19页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

#include#include#include#includestruct studentchar sno50;char sname50;char sprofession50;char snativeplace50;char sgrade50;struct birthchar syear50;char smonth50;char sday50;struct smarkchar English50;char maths50;char Chinese50;char physics50;int check(char no100,char code100);int checksno(char no100);int check(char no100,char code100)char a100,b100;ifstream ifs(secret.txt,ios:in);ifsa;while(strcmp(no,a)!=0&!ifs.eof()ifsa;ifs.seekg(1,ios:cur);ifsb;if(strcmp(b,code)=0)return 1;elsereturn -1;int checksno(char no100)int i=1;char a100;ifstream ifs(已注册学号.txt,ios:in);while(!ifs.eof()ifsa;if(strcmp(a,no)=0)i=-1;break;return i;int main()end8:cout欢迎使用学生信息管理系统!endl;coutendl;int j;end9:cout1.学生操作:endl;cout2.老师操作:endl;coutj;system(cls);if(j=1)for(;)end17:cout欢迎进入学生界面!endl;coutendl;coutendl;char no100;char code100;int n;student stu;birth birth1;cout1.学生注册:endl;cout2.添加学生基本信息:endl;cout3.学生基本信息查询:endl;cout4.学生基本信息修改:endl;cout5.选修课程:endl;cout6.密码修改:endl;cout7.返回首界面:endl;cout8.退出系统:endl;coutendl;coutn;if(n=1)int count=0;system(cls);end1:cout学生注册界面endl;coutendl;coutendl;char no100,code100;char kong100= ;cout请您注册endl;coutendl;coutno;int checsno=checksno(no);if(checsno=-1)cout对不起,此学号已被注册,请重试!=5)cout对不起,您尝试的次数过多,注册界面将退出!endl;Sleep(600);system(cls);goto end17;Sleep(600);system(cls);goto end1;coutcode;coutendl;ofstream ofs1(secret.txt,ios:out|ios:app);ofstream ofs2(information.txt,ios:out|ios:app);ofstream ofs3(已注册学号.txt,ios:out|ios:app);ofs1no ;ofs1code;ofs1kongendl;ofs2no;ofs2kongendl;ofs3noendl;ofs1.close();ofs2.close();ofs3.close();cout注册成功!endl;else if(n=2)int count2=0;end15:system(cls);cout学生添加基本信息界面endl;coutendl;coutendl;cout请先登录!endl;coutendl;char no100,code100,a100,b100,c100,d100;int count=0;int e=-1;coutno;ifstream ifs2(已注册学号.txt,ios:in);while(!ifs2.eof()ifs2d;if(strcmp(d,no)=0)e=1;break;if(e=-1)cout此学号还没注册,请重试!=5)cout对不起,您的尝试次数过多,请您检查一下学号是否已经注册!c;if(strcmp(c,no)=0)cout对不起,您已经添加您的基本信息了!endl;Sleep(500);goto end15;coutendl;end2:coutcode;coutendl;int chec=check(no,code);if(chec=-1)cout密码错误,请重试!=3)cout对不起,您尝试的次数过多,系统将自动关闭!endl;Sleep(400);goto end10;Sleep(1000);system(cls);goto end2;elsecout登录成功!;coutendl;Sleep(500);system(cls);end23:cout请登录并输入学生基本信息:endl;coutendl;coutendl;coutstu.sno;if(strcmp(stu.sno,no)!=0)cout对不起,您添加的学号与您所注册的学号不符,请重试!endl;Sleep(1000);system(cls);goto end23;coutendl;coutstu.sname;coutendl;coutstu.sgrade;coutendl;coutstu.sprofession;coutendl;coutbirth1.syear;cinbirth1.smonth;cinbirth1.sday;coutendl;coutstu.snativeplace;coutendl;cout基本信息添加完毕!endl;ofstream ofs(informationfinish.txt,ios:out|ios:app);ofsstu.sno;ofsa;while(strcmp(stu.sno,a)!=0&!fs.eof()fsa;fs.seekg(1,ios:cur);fsstu.sname ;fsstu.sgrade ;fsstu.sprofession ;fsstu.snativeplace ;fsbirth1.syear ;fsbirth1.smonth ;fsbirth1.sday;fs.close();ofs.close();else if(n=3)int count2=0;int count3=0;int e=-1;int f=-1;end18:system(cls);cout基本信息查询界面endl;coutendl;coutendl;char no100,code100,a100,d100,g100;int count=0;coutno;ifstream ifs2(已注册学号.txt,ios:in);while(!ifs2.eof()ifs2d;if(strcmp(d,no)=0)e=1;break;if(e=-1)cout此学号还没注册,请重试!=5)cout对不起,您的尝试次数过多,请您检查一下学号是否已经注册!endl;Sleep(2000);system(cls);goto end17;Sleep(600);goto end18;coutg;if(strcmp(g,no)=0)f=1;break;if(f=-1)cout此学号还没添加基本信息,请重试!=5)cout对不起,您的尝试次数过多,请您返回添加您的基本信息!endl;Sleep(2000);system(cls);goto end17;Sleep(600);goto end18;end3:coutcode;coutendl;int chec=check(no,code);if(chec=-1)cout密码错误,请重试!=3)cout对不起,您尝试的次数过多,系统将自动关闭!endl;Sleep(400);goto end10;Sleep(1000);system(cls);goto end3;elsecout登录成功!;coutendl;Sleep(600);system(cls);couta;while(strcmp(a,no)!=0&!ifs.eof()ifsa;ifs.seekg(1,ios:cur);ifsstu.sname;ifs.seekg(1,ios:cur);ifsstu.sgrade;ifs.seekg(1,ios:cur);ifsstu.sprofession;ifs.seekg(1,ios:cur);ifsstu.snativeplace;ifs.seekg(1,ios:cur);ifsbirth1.syear;ifs.seekg(1,ios:cur);ifsbirth1.smonth;ifs.seekg(1,ios:cur);ifsbirth1.sday;cout学生学号:noendl;cout学生姓名:stu.snameendl;cout学生年级:stu.sgradeendl;cout学生专业:stu.sprofessionendl;cout学生籍贯:stu.snativeplaceendl;cout学生出生年月日:birth1.syear年birth1.smonth月birth1.sday日endl;ifs.close();coutendl;coutendl;int fanhui;coutfanhui;if(fanhui=1)system(cls);goto end17;else if(n=4)system(cls);cout欢迎进入学生基本信息修改界面!endl;coutendl;coutendl;int count2=0;int count3=0;int e=-1;int f=-1;end19:system(cls);cout基本信息修改登录界面endl;coutendl;coutendl;char no100,code100,a100,d100,g100;int count=0;coutno;ifstream ifs2(已注册学号.txt,ios:in);while(!ifs2.eof()ifs2d;if(strcmp(d,no)=0)e=1;break;if(e=-1)cout此学号还没注册,请重试!=5)cout对不起,您的尝试次数过多,请您检查一下学号是否已经注册!endl;Sleep(2000);system(cls);goto end17;Sleep(600);goto end19;coutg;if(strcmp(g,no)=0)f=1;break;if(f=-1)cout此学号还没添加基本信息,请重试!=5)cout对不起,您的尝试次数过多,请您返回添加您的基本信息!endl;Sleep(2000);system(cls);goto end17;Sleep(600);goto end19;end20:coutcode;coutendl;int chec=check(no,code);if(chec=-1)cout密码错误,请重试!=3)cout对不起,您尝试的次数过多,系统将自动关闭!endl;Sleep(400);goto end10;Sleep(1000);system(cls);goto end20;elsecout登录成功!;coutendl;Sleep(600);system(cls);end22:couttemp;while(strcmp(temp,no)!=0&!ifs6.eof()ifs6temp;ifs6a2;ifs6b2;ifs6c2;ifs6d2;ifs6e2;ifs6f2;ifs6g2;cout当前学员的基本信息:endl;coutendl;cout学生姓名:a2endl;cout学生年级:b2endl;cout学生专业:c2endl;cout学生籍贯:d2endl;cout学生出生年月日:e2年f2月g2日endl;coutendl;cout操作选择:endl;cout1.学生姓名修改:endl;cout2.学生年级修改:endl;cout3.学生专业修改:endl;cout4.学生籍贯修改:endl;cout5.学生出生年份:endl;cout6.学生出生月份:endl;cout7.学生出生日:endl;cout8.返回学员界面:endl;coutendl;int i,num;coutnum;if(num=8)system(cls);goto end17;num-;char a1100,b1100,c1100,d1100,e1100,f1100;char *infor7;for(i=0;ia1;while(strcmp(a1,no)!=0&!ifs4.eof()ifs4a1;ifs4.seekg(1,ios:cur);for(i=0;ib1;strcpy(infori,b1);coutendl;coutendl;coutc1;strcpy(infornum,c1);fstream fs4(information.txt,ios:in|ios:out);fs4d1;while(strcmp(d1,no)!=0&!fs4.eof()fs4d1;fs4e1;while(strcmp(e1,no)!=0&!fs5.eof()fs5e1;fs5.seekg(1,ios:cur);for(i=0;i7;i+)fs5infori;fs5 ;fs5.close();for(i=0;i7;i+)delete infori;cout修改成功!endl;Sleep(1000);system(cls);goto end22;else if(n=5)int count2=0;int h=-1;end21:system(cls);cout课程选修界面endl;coutendl;coutendl;char no100,code100,a100,g100;int count=0;coutno;ifstream ifs2(已注册学号.txt,ios:in);while(!ifs2.eof()ifs2g;if(strcmp(g,no)=0)h=1;break;if(h=-1)cout此学号还没注册,请重试!=5)cout对不起,您的尝试次数过多,请您检查一下学号是否已经注册!endl;Sleep(2000);system(cls);goto end17;Sleep(600);goto end21;coutendl;end13:coutcode;coutendl;int chec=check(no,code);if(chec=-1)cout密码错误,请重试!=5)cout对不起,您尝试的次数过多,系统将自动关闭!endl;Sleep(1000);goto end10;Sleep(1000);system(cls);goto end13;elsecout登录成功!endl;Sleep(500);system(cls);char c;cout欢迎进入选修课选课模块!endl;coutendl;ifstream ifs(选修课.txt,ios:in|ios:binary);while(!ifs.eof()ifs.read(char*)&c,sizeof(char);coutc;cout提示:一学期最多选修3门课程。endl;coutendl;coutendl;char d100,e100,f100;coutd;coutendl;coute;coutendl;coutf;coutendl;strcat(d,.txt);strcat(e,.txt);strcat(f,.txt);ofstream ofs1(d,ios:out|ios:app);ofstream ofs2(e,ios:out|ios:app);ofstream ofs3(f,ios:out|ios:app);ofs1no;ofs1 ;ofs1endl;ofs2no;ofs2 ;ofs2endl;ofs3no;ofs3 ;ofs3endl;else if(n=6)system(cls);cout密码修改界面!endl;coutendl;coutendl;cout请先登录!endl;coutendl;coutendl;char no100,code100,a100;int count=0;coutno;coutendl;end16:coutcode;coutendl;int chec=check(no,code);if(chec=-1)cout密码错误,请重试!=3)cout对不起,您尝试的次数过多,系统将自动关闭!endl;Sleep(400);goto end10;Sleep(1000);system(cls);goto end16;elsecout登录成功!;coutc;while(strcmp(c,no)!=0&!fs.eof()fsc;fs ;fs.close();coutnewcode;fstream fs2(secret.txt,ios:in|ios:out);fsd;while(strcmp(d,no)!=0&!fs2.eof()fs2d;fs2.seekg(1,ios:cur);fs2newcode;fs2.close();coutendl;coutendl;cout密码修改成功!endl;Sleep(1000);else if(n=7)system(cls);goto end8; else if(n=8)return 0;elsecout对不起,您选择的操作无效,请重试!endl;Sleep(600);system(cls);Sleep(500);system(cls);system(pause);else if(j=2)end11:coutendl;coutendl;coutendl;coutendl;char a100,b100,col100,colcode100,filename100;ifstream ifs(学院认证码.txt,ios:in);cout注:学院有:一院、二院、三院、四院!endl;coutendl;coutcol;int exa=-1;while(!ifs.eof()ifsa;if(strcmp(a,col)=0)exa=1;break;if(exa=-1)cout不存在此学院,请重试!a;while(strcmp(a,col)!=0&!ifs2.eof()ifs2a;coutendl;coutcolcode;ifs2.seekg(1,ios:cur);ifs2b;if(strcmp(b,colcode)!=0)cout认证失败,请重试!endl;Sleep(500);system(cls);goto end12;coutendl;cout老师身份认证成功!endl;char filename2100;strcpy(filename,col);strcpy(filename2,filename);strcat(filename,.txt);Sleep(600);char kemu100;int kemu2=-1;end24:system(cls);cout欢迎进入 filename2 教育管理模块!endl;coutendl;coutendl;coutsubject;while(strcmp(subject,学科)!=0)ifs3subject;ifs3.seekg(1,ios:cur);coutfilename2学科:subject;coutsubjectsubject)coutsubjectendl;ch

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论