📄 sqqueue.cpp
字号:
// SqQueue.cpp: implementation of the SqQueue class.
//
//////////////////////////////////////////////////////////////////////
#include "SqQueue.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
SqQueue::SqQueue()
{
head=last=new Node;
}
SqQueue::~SqQueue()
{
}
bool SqQueue::EnQueue(char e)
{
Node *p=new Node;
if(p==NULL)
{ cout<<"Stack is overflow"<<endl;
return false;
}
else
{ p->word=e;
last->next=p;
last=p;
p->next=NULL;
return true;
}
}
bool SqQueue::DeQueue(char &e)
{
if(head==NULL)
{ cout<<"Stack is empty"<<endl;
return false;
}
else
{ Node *p=head;
head=head->next;
e=p->word;
delete p;
return true;
}
}
void SqQueue::OutQueue()
{
for(Node *p=head->next;p!=NULL;p=p->next)
cout<<p->word;
cout<<endl;
}
bool SqQueue::QueueEmpty()
{
return head==last;
}
void SqQueue::EnQueue_A()
{
EnQueue('s');
EnQueue('a');
EnQueue('e');
}
void SqQueue::EnQueue_B()
{
EnQueue('t');
EnQueue_A();
EnQueue('d');
EnQueue_A();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -