设为首页
收藏本站
开启辅助访问
切换到窄版
登录
立即注册
中问网首页
我的收藏
站长博客
搜索
搜索
本版
帖子
用户
第一问答网
»
论坛
›
中问网
›
问答
›
急求用C++实现学生信息管理 我的程序有错误 恳请大侠修 ...
返回列表
发新帖
急求用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;}};//////!!!!!!加上这个就行了!!!!!!!!!!!
回复
使用道具
举报
返回列表
发新帖
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
立即注册
本版积分规则
发表回复
回帖后跳转到最后一页
千问
主题
0
回帖
4882万
积分
论坛元老
论坛元老, 积分 48824836, 距离下一级还需 -38824837 积分
论坛元老, 积分 48824836, 距离下一级还需 -38824837 积分
积分
48824836
加好友
发消息
回复楼主
返回列表
问答
热门排行