C++学生管理系统代码.doc
《C++学生管理系统代码.doc》由会员分享,可在线阅读,更多相关《C++学生管理系统代码.doc(140页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateC+学生管理系统代码#include#include #include #include #include #include #include usingnamespacestd; constintNAME_NUM=30; structstudent charnameNAME_NUM; floatnum; floatchinaNum; floatenglishNum;
2、 floatmathNum; floataverage; floatresult; intpos; student*next; ; voidPrint(student*head); voidInsertFront(student*&head,student*pNew); voidInsertRear(student*&head,student*pNew); student*Find(student*head,char*findStr,chartype); student*Read(); voidWrite(student*head); voidShowList(student*head); i
3、ntGetLength(student*head); voidDelete(student*&head,char*delStr,intdelNum); voidFindMaxOrMin(student*head,chartype,charmaxOrMin); voidReword(student*pStd); voidSort(student*&head,chartype,charmaxOrMin); voidCount(student*&head); voidDeleteAll(student*&head); boolEnter(chartype); voidSetTitle(boolisL
4、oad); voidAboutMe(); voidChaXun(stringstr,student*head); voidPaiMing(stringstr,student*head); voidShanChu(stringstr,student*&head); voidXianShi(stringstr,student*head); voidXuiGai(stringstr,student*&head); voidZengJia(stringstr,student*&head); intRun(); boolEnter(chartype) ofstreamout(Password.pwd,i
5、os:app); ifstreamin(Password.pwd); strings2; intnum=0; stringzhangHao; stringmiMa; while(!in.eof() insnum; num+; if(num=2) break; if(pare()=0|type=2) if(pare()=0&type!=2) cout你是第一次使用本程序,请设置帐号和密码.endl; else boolisLoad=false; isLoad=Enter(1); if(isLoad=true) cout修改用户.endl; out.close(); out.open(Passwo
6、rd.pwd,ios:trunc); else cout你输入的密码错误.endl; cout你不是管理员不能修改密码.endl; returnfalse; couts0; couts1; strings1,s2; for(inti=0;is0.size();i+) s1+=char(int(s0i)+11); for(i=0;is1.size();i+) s2+=char(int(s1i)+11); s0=s1; s1=s2; for(i=0;i=1;i+) outsi; out.close(); strings1,s2; for(inti=0;is0.size();i+) s1+=char
7、(int(s0i)-11); for(i=0;is1.size();i+) s2+=char(int(s1i)-11); coutzhangHao; coutmiMa; if(zhangHpare(s1)=0&miMpare(s2)=0) returntrue; else returnfalse; returnfalse; voidPrint(student*head) student*pHead=head; intnum=strlen(head-name); while(head) if(numname) num=strlen(head-name); head=head-next; head
8、=pHead; coutsetw(num)namesetw(8) numsetw(10)chinaNum setw(10)mathNumsetw(10) englishNumsetw(8)result setw(8)averagesetw(5)posendl; voidShowList(student*head) cout姓名:setw(8)座号:setw(10) 语文分数:setw(10)数学分数: setw(10)英语分数:setw(8)总分数: setw(8)平均分:setw(6)名次:endlnext; coutnext; out.close(); student*Read() ifs
9、treamin(Student.dat); student*head; student*pP; student*pEnd; pP=newstudent; pEnd=head=pP; student*pS=newstudent; memset(pS-name,0,NAME_NUM); in.read(char*)pS,sizeof(student); if(strcmp(pS-name,0)=0) returnNULL; strcpy(pP-name,pS-name); pP-num=pS-num; pP-chinaNum=pS-chinaNum; pP-englishNum=pS-englis
10、hNum; pP-mathNum=pS-mathNum; while(!in.eof() in.read(char*)pS,sizeof(student); pEnd-next=pP; pEnd=pP; pP=newstudent; strcpy(pP-name,pS-name); pP-num=pS-num; pP-chinaNum=pS-chinaNum; pP-englishNum=pS-englishNum; pP-mathNum=pS-mathNum; pEnd-next=NULL; deletepP; returnhead; student*Find(student*head,ch
11、ar*findStr,chartype) /*参数说明: type=1按名字查找 type=2按座号查找 type=3按语文查找 type=4按数学查找 type=5按英语查找 type=6按总分查找 type=7按平均分查找 type=8按排名查找/没有实现 */ boolisFind=false; student*firstStd=NULL; cout姓名:setw(8)座号:setw(10) 语文分数:setw(10)数学分数: setw(10)英语分数:setw(8)总分数: setw(8)平均分:setw(5)名次:endlname,findStr)=0) if(firstStd=N
12、ULL) firstStd=head; Print(head); isFind=true; if(head-next=NULL) returnfirstStd; elseif(type=2) if(int(head-num)=int(atof(findStr) if(firstStd=NULL) firstStd=head; Print(head); isFind=true; if(head-next=NULL) returnfirstStd; elseif(type=3) if(int(head-chinaNum)=int(atof(findStr) if(firstStd=NULL) fi
13、rstStd=head; Print(head); isFind=true; if(head-next=NULL) returnfirstStd; elseif(type=4) if(int(head-mathNum)=int(atof(findStr) if(firstStd=NULL) firstStd=head; Print(head); isFind=true; if(head-next=NULL) returnfirstStd; elseif(type=5) if(int(head-englishNum)=int(atof(findStr) if(firstStd=NULL) fir
14、stStd=head; Print(head); isFind=true; if(head-next=NULL) returnfirstStd; elseif(type=6) if(int(head-result)=int(atof(findStr) if(firstStd=NULL) firstStd=head; Print(head); isFind=true; if(head-next=NULL) returnfirstStd; elseif(type=7) if(int(head-average)=int(atof(findStr) if(firstStd=NULL) firstStd
15、=head; Print(head); isFind=true; if(head-next=NULL) returnfirstStd; elseif(type=8) if(int(head-pos)=int(atof(findStr) if(firstStd=NULL) firstStd=head; Print(head); isFind=true; if(head-next=NULL) returnfirstStd; head=head-next; if(isFind=false) cout找不到你要找的记录.next=NULL) break; head=head-next; strcpy(
16、pS-name,pNew-name); pS-num=pNew-num; pS-chinaNum=pNew-chinaNum; pS-englishNum=pNew-englishNum; pS-mathNum=pNew-mathNum; pS-next=NULL; pEnd-next=pS; head=pHead; voidInsertFront(student*&head,student*pNew) student*pHead=newstudent; strcpy(pHead-name,pNew-name); pHead-num=pNew-num; pHead-chinaNum=pNew-
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C+ 学生 管理 系统 代码
限制150内