急求用C++实现学生信息管理 我的程序有错误 恳请大侠修改指正

[复制链接]
查看11 | 回复1 | 2010-5-4 23:39:20 | 显示全部楼层 |阅读模式
是不是先说下你要实现的是什么.怎么出错法?
回复

使用道具 举报

千问 | 2010-5-4 23:39:20 | 显示全部楼层
楼主,在程序最后加上这个};就OK了。因为你在classlist类的最后丢掉了};,加上就OK了,还是把修改代码也给你吧,看程序的最后。#include#include#includeclassstud{public:char*name;char*number;floatscore;stud*pre;stud*next;stud(){cout>name;cout>number;cout>score;}};classlist{protected:stud*phead;stud*ptail;public:list*crat()//该函数用来建立动态链表{stud*p1,*p2;p1=newstud;phead=p1;p2=p1;cout>"name";if(p1->name!=0){cout>"number";cin>>"score";}else{deletep1;p2=NULL;phead=NULL;return0;}while(p1->name!=0){p1=newstud;cout>"name";if(p1->name!=0){cout>"number";cin>>"score";p2->next=p1;p2=p1;}p2->next=NULL;return0;}}voidprint(stud*phead)//输出信息{stud*p;p=phead;coutname)){coutnumbernamescorenext;}}stud*Gethead()//得到头结点{returnphead;}stud*Gettail()//得到尾结点{stud*p;p=ptail->pre;returnp;}voidRemovehead()//删除头结点{stud*p;p=phead->next;deletephead;phead=p;phead->pre=NULL;}voidRemovetail()//删除尾结点{stud*p;p=Gettail();p->pre->next=ptail;ptail->pre=p->pre;deletep;}stud*Addhead1()//添加头结点{stud*p;coutpre=NULL;p->next=Gethead();phead->pre=p;phead=p;returnphead;}list*AddheadA_B(list*ha,list*hb){stud*p1,*p2;p1=ha->Gettail();p2=p1->next;p1->next=hb->Gethead();hb->phead->pre=p1;deletep2;ha->ptail=hb->ptail;returnha;}};//////!!!!!!加上这个就行了!!!!!!!!!!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行