📄 queue.cpp
字号:
// Queue.cpp: implementation of the CQueue class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "photostar.h"
#include "Queue.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CQueue::CQueue()
{
}
CQueue::~CQueue()
{
}
BOOL CQueue::DeQueue(int &e)
{
if (front==rear)
{
return FALSE;
}
QueuePtr p=front->next;
e=p->data;
front->next=p->next;
if (rear==p)
{
rear=front;
}
free(p);
return TRUE;
}
void CQueue::EnQueue(int e)
{
QueuePtr p=new QNode;
p->data=e;
p->next=NULL;
rear->next=p;
rear=p;
return;
}
void CQueue::DestroyQueue()
{
while (front)
{
rear=front->next;
delete front;
front=rear;
}
return;
}
void CQueue::InitQueue()
{
front = rear = new QNode;
front->next = NULL;
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -