我想我该做的都做了,可是还是不行

smileme 2001-05-16 10:39:00
小弟编了一个队列的类,可是怎么也通不过
程序在bc5.0中调试编译时有6个错误:
undefined symbol 'MaxQSize'
undefined symbol 'MaxQsize'
undefined symbol 'count'
undefined symbol 'front'
undefined symbol 'qlist'
undefined symbol 'MaxQSize'
可是我要做的都做了呀。比如unfefined symbol 'MaxQSize'我在程序中早有了
const int MaxQSzie=50;
至于 count 、front、qlist这是类的成员呀


# include<iostream.h>
# include<stdlib.h>
const int MaxQSzie=50;
typedef int DataType;
class Queue
{
protected:
int front ,rear,count;
DataType qlist[MaxQSzie];
public:
Queue(void);
//改变队列的操作
void QInsert(const DataType & item);
DataType QDelete(void);
void ClearQueue(void);
//访问队列
DataType QFront(void)const;
//检测队列状态
int QLength(void)const;
int QFull(void)const;
int QEmpty(void)const;
} ;
Queue::Queue(void):front(0),rear(0),count(0)
{}
//--------------------------------------------------
void Queue::QInsert(const DataType & item)
{
if(count==MaxQSize)
{cerr<<"Queue overflow!"<<endl;
exit(1);
}
count++;
qlist[rear]=item;
rear=(rear+1)%MaxQSize;
}
//-----------------------------------------------------
//删除对首元素返回其值
DataType Queue::QDelete(void)
{
DataType temp;
if(count==0)
{cerr<<"Deleting from an empty queue!"<<endl;
exit(1);
}
temp=qlist[front];
count--;
front=(front+1)%MaxQSize;
return temp;
}
//--------------------------------------------------------
void Queue::ClearQueue(void)
{front=0;rear=0;count=0;}
//--------------------------------------------------------
DataType QFront(void)
{
if(count==0)
{cerr<<"It's empty!"<<endl;
exit(1);
}
return qlist[front];
}
//---------------------------------------------------------
int Queue::QLength(void)const
{ return count;}
//---------------------------------------------------------
int Queue::QEmpty(void)const
{ return count==0;}
//----------------------------------------------------------
int Queue::QFull(void)const
{ return count==MaxQSize ; }
//===================================================

void main()
{ Queue a;
a.QInsert(3);
a.QInsert(5);
do { cout<<a.QFront()<<endl;
a.QDelete();
}while(!a.QEmpty()) ;

}
...全文
38 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
kyaohong 2001-05-21
  • 打赏
  • 举报
回复
呵呵,好像是拼写有误啊
holyfire 2001-05-17
  • 打赏
  • 举报
回复
const int MaxQSzie=50; 'MaxQSize'拼写错了

DataType QFront(void)
改成
DataType Queue::QFront(void)

69,374

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧