?? queue.cpp
字號:
// Queue.cpp: implementation of the Queue class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Queue.h"
#include "stdlib.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Queue::Queue()
{
LNode *s = new LNode;
front=s;
rear=s;
front->next=NULL;
}
Queue::~Queue()
{
QueuePtr p;
while(front)
{
p=front;
front=front->next;
delete p;
}
}
void Queue::insert_queue(int a)
{
LNode *s = new LNode;
s->data=a;
s->next=NULL;
rear->next=s;
rear=s;
}
void Queue::output_queue()
{
QueuePtr p=front->next;
while(p!=NULL)
{
cout<<p->data<<" ";
p=p->next;
}
cout<<"\n";
}
void Queue::delete_queue()
{
QueuePtr p;
p=front->next;
if(p==NULL) {delete p; exit;}
front->next=p->next;
if(rear==p) rear=front;
delete p;
}
int Queue::get_queue()
{
return front->next->data;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -