c语言学生成绩统计的代码,际学生成绩统计管理C语言尾实现源代码.doc

有两个,第二个写了些注释,你自己看一下觉得哪个理解的好

方法一:

#include #include #include #include using?namespace?std; class?CData { public: CData(){}; virtual?int?comparename(CData?&)?=0; virtual?void?show()=0; virtual?~CData(){}; }; class?CNode { public: CNode(){pdata=0;pnext=0;} CNode(CNode?&n); void?inputdata(CData?*pd){pdata=pd;} void?shownode(){pdata->show();} CData?*getdata(){return?pdata;} friend?class?CList; private: CData?*pdata; CNode?*pnext; }; CNode::CNode(CNode?&n) { pdata=n.pdata; pnext=n.pnext; } ? class?CList { public: CList(){phead=0;} ~CList(){deletelist();} void?addnode(CNode?*pnode); void?deletelist(); CNode?*deletenode(CNode?*pnode); CNode?*lookup(CData?&data); CNode?*getlisthead(){return?phead;} void?showlist(); CNode?*getnext(CNode?*pnode); private: CNode?*?phead; }; void?CList::addnode(CNode?*pnode) { if(phead==0) { phead=pnode; pnode->pnext=0; return; } else { pnode->pnext=phead; phead=pnode; } } void?CList::deletelist() { CNode?*p1,*p2; p1=phead; while(p1) { delete?p1->pdata; p2=p1; p1=p1->pnext; delete?p2; } } 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; return?pnode; } p2->pnext=p1->pnext; return?pnode; } CNode?*CList::lookup(CData?&data) { CNode?*p1=phead; while(p1) { if(p1->pdata->comparename(data)==0) return?p1; ????????p1=p1->pnext;??? } return?0; } void?CList::showlist() { if(phead==0) cout<pdata->show(); ????p=p->pnext; } } } CNode?*CList::getnext(CNode?*pnode) { CNode?*p=pnode; p=p->pnext; ????return?p; } class?Student:public?CData { private: char?s_class[17]; char?s_num[17]; char?s_name[17]; double?ele_technique; double?c_program; double?mul_technique; ????double?col_english; double?sen_math; double?col_gym; double

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值