欢迎来到天天文库
浏览记录
ID:46449600
大小:77.00 KB
页数:3页
时间:2019-11-23
《数据结构班级学生管理》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、福州大学数学与计算机科学学院《数据结构》上机实验报告绩FII-?7息生学级班实验目的和要求諳入统坏据理紹数管娉括表赅包资,工1.理个实验算法主体内容及Voxt;皿口2、cmt::sID3、rtududMn.gn.gn.gud"MS”MasszIa.ndgoldtudold#i#ills#d#d#dCI{NstvslvcinvEchstEstVo{ci・clci}stvochintvo{c}cl{pucVbvstv〜Class();private:int_Len;Student*.head;)CLS;Class::Class()Ihead=newStudent;Len=0;)voidClass::addStu(){Student*ncwStu=ncwStudent;newSlu->stuInit();new4、Stu->setNext(_head->getNext());_head->setNext(newStu);Len++;)boolClass::dclStu(char*stuID){Student*test,*pre;pre=_head;test=pre・>getNext();while(test!=NULL){if(!(test->cmpID(stuID))){pre->setNext(test->getNext());deletetest;returnTRUE;}pre=test;test=pre->getNext(5、);}returnFALSE;)voidClass::sort()(Student^pre^test^sortPre^sortStu;sortPrc=_hcad,sortStu=sortPrc->gctNcxt();while(sortStu!=NULL){pre=_head,test=pre->getNext();while(test->cmpID(sortStu->getID())<0){pre=test;test=pre->getNext();}if(test!=sortStu){sortPre->setNext(6、sortStu->getNext());prc->sctNcxt(sortStu);sortStu->setNext(test);}elsesortPre=sortPre->getNext();sortStu=sortPre->getNext();}}Student*Class::getStu(char*stuID){Student*test=_head->getNext();while(test!=NULL){if(!(tcst->cmpID(stuID))){tcst->stuOut();rcturntest;}le7、st=test->getNext();)cout«HnothisstuH«endl;returnNULL;}voidClass::classOut(){Student*test=_head->getNext();while(test!=NULL){test->stuOut();test=test->getNext();)}Class::-Class(){Student*test=_head;while(test!=NULL){_hcad=tcst->gctNcxt();deletetest;test=_head;)}in8、tmain(){intn;cin»n;cin.ignorc();while(n-){CLS.addStuO;}cout«Hallstu:,f«endl;CLS.classOut();CLS.sort();cout«HsortingH«endl;CLS.classOut();cout«Hfind:,,«endl;cha
2、cmt::sID3、rtududMn.gn.gn.gud"MS”MasszIa.ndgoldtudold#i#ills#d#d#dCI{NstvslvcinvEchstEstVo{ci・clci}stvochintvo{c}cl{pucVbvstv〜Class();private:int_Len;Student*.head;)CLS;Class::Class()Ihead=newStudent;Len=0;)voidClass::addStu(){Student*ncwStu=ncwStudent;newSlu->stuInit();new4、Stu->setNext(_head->getNext());_head->setNext(newStu);Len++;)boolClass::dclStu(char*stuID){Student*test,*pre;pre=_head;test=pre・>getNext();while(test!=NULL){if(!(test->cmpID(stuID))){pre->setNext(test->getNext());deletetest;returnTRUE;}pre=test;test=pre->getNext(5、);}returnFALSE;)voidClass::sort()(Student^pre^test^sortPre^sortStu;sortPrc=_hcad,sortStu=sortPrc->gctNcxt();while(sortStu!=NULL){pre=_head,test=pre->getNext();while(test->cmpID(sortStu->getID())<0){pre=test;test=pre->getNext();}if(test!=sortStu){sortPre->setNext(6、sortStu->getNext());prc->sctNcxt(sortStu);sortStu->setNext(test);}elsesortPre=sortPre->getNext();sortStu=sortPre->getNext();}}Student*Class::getStu(char*stuID){Student*test=_head->getNext();while(test!=NULL){if(!(tcst->cmpID(stuID))){tcst->stuOut();rcturntest;}le7、st=test->getNext();)cout«HnothisstuH«endl;returnNULL;}voidClass::classOut(){Student*test=_head->getNext();while(test!=NULL){test->stuOut();test=test->getNext();)}Class::-Class(){Student*test=_head;while(test!=NULL){_hcad=tcst->gctNcxt();deletetest;test=_head;)}in8、tmain(){intn;cin»n;cin.ignorc();while(n-){CLS.addStuO;}cout«Hallstu:,f«endl;CLS.classOut();CLS.sort();cout«HsortingH«endl;CLS.classOut();cout«Hfind:,,«endl;cha
3、rtududMn.gn.gn.gud"MS”MasszIa.ndgoldtudold#i#ills#d#d#dCI{NstvslvcinvEchstEstVo{ci・clci}stvochintvo{c}cl{pucVbvstv〜Class();private:int_Len;Student*.head;)CLS;Class::Class()Ihead=newStudent;Len=0;)voidClass::addStu(){Student*ncwStu=ncwStudent;newSlu->stuInit();new
4、Stu->setNext(_head->getNext());_head->setNext(newStu);Len++;)boolClass::dclStu(char*stuID){Student*test,*pre;pre=_head;test=pre・>getNext();while(test!=NULL){if(!(test->cmpID(stuID))){pre->setNext(test->getNext());deletetest;returnTRUE;}pre=test;test=pre->getNext(
5、);}returnFALSE;)voidClass::sort()(Student^pre^test^sortPre^sortStu;sortPrc=_hcad,sortStu=sortPrc->gctNcxt();while(sortStu!=NULL){pre=_head,test=pre->getNext();while(test->cmpID(sortStu->getID())<0){pre=test;test=pre->getNext();}if(test!=sortStu){sortPre->setNext(
6、sortStu->getNext());prc->sctNcxt(sortStu);sortStu->setNext(test);}elsesortPre=sortPre->getNext();sortStu=sortPre->getNext();}}Student*Class::getStu(char*stuID){Student*test=_head->getNext();while(test!=NULL){if(!(tcst->cmpID(stuID))){tcst->stuOut();rcturntest;}le
7、st=test->getNext();)cout«HnothisstuH«endl;returnNULL;}voidClass::classOut(){Student*test=_head->getNext();while(test!=NULL){test->stuOut();test=test->getNext();)}Class::-Class(){Student*test=_head;while(test!=NULL){_hcad=tcst->gctNcxt();deletetest;test=_head;)}in
8、tmain(){intn;cin»n;cin.ignorc();while(n-){CLS.addStuO;}cout«Hallstu:,f«endl;CLS.classOut();CLS.sort();cout«HsortingH«endl;CLS.classOut();cout«Hfind:,,«endl;cha
此文档下载收益归作者所有