⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqqueue.cpp

📁 VC++编的数据结构 魔王语言解释,可以输入多对括号,已经在VC编译通过
💻 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 + -