欢迎来到天天文库
浏览记录
ID:12597977
大小:38.00 KB
页数:8页
时间:2018-07-18
《c 编写的简单的学生成绩管理系统》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#include#include#include#includeusingnamespacestd;classCData{public:CData(){};virtualintcomparename(CData&)=0;virtualvoidshow()=0;virtual~CData(){};};classCNode{public:CNode(){pdata=0;pnext=0;}CNode(CNode&n);voidinputdata(CData*pd){pdata=pd;}voi
2、dshownode(){pdata->show();}CData*getdata(){returnpdata;}friendclassCList;private:CData*pdata;CNode*pnext;};CNode::CNode(CNode&n){pdata=n.pdata;pnext=n.pnext;}classCList{public:CList(){phead=0;}~CList(){deletelist();}voidaddnode(CNode*pnode);voiddeletelist();CNode*deletenode(CNode*
3、pnode);CNode*lookup(CData&data);CNode*getlisthead(){returnphead;}voidshowlist();CNode*getnext(CNode*pnode);private:CNode*phead;};voidCList::addnode(CNode*pnode){if(phead==0){phead=pnode;pnode->pnext=0;return;}else{pnode->pnext=phead;phead=pnode;}}voidCList::deletelist(){CNode*p1,*
4、p2;p1=phead;while(p1){deletep1->pdata;p2=p1;p1=p1->pnext;deletep2;}}CNode*CList::deletenode(CNode*pnode){CNode*p1,*p2;p1=phead;while(p1!=pnode&&p1->pnext!=0){p2=p1;p1=p1->pnext;}if(p1==phead){phead=phead->pnext;returnpnode;}p2->pnext=p1->pnext;returnpnode;}CNode*CList::lookup(CDat
5、a&data){CNode*p1=phead;while(p1){if(p1->pdata->comparename(data)==0)returnp1;p1=p1->pnext;}return0;}voidCList::showlist(){if(phead==0)cout<<"对不起,没有任何记录.";else{CNode*p=phead;while(p){p->pdata->show();p=p->pnext;}}}CNode*CList::getnext(CNode*pnode){CNode*p=pnode;p=p->pnext;returnp
6、;}classStudent:publicCData{private:chars_class[17];chars_num[17];chars_name[17];doubleele_technique;doublec_program;doublemul_technique;doublecol_english;doublesen_math;doublecol_gym;doublemarx_economy;doubleaverage;public:Student();virtualintcomparename(CData&);voidshow();voidset
7、(char*c,char*n,char*nam,doublee,doublecp,doublem,doublece,doublesm,doublecg,doublemar,doubleaver);};Student::Student(){strcpy(s_class," ");strcpy(s_num," ");strcpy(s_name," ");ele_technique=0;c_program=0;mul_technique=0;col_english=0;sen_math=0;col_gym=0;marx_economy=0;}intStud
8、ent::comparename(CData&data){Stud
此文档下载收益归作者所有