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

📄 extended_queue.cpp

📁 包括图、二叉树、链表
💻 CPP
字号:
#include "Extended_queue.h"

Error_code Extended_queue::serve_and_retrieve(Queue_entry &item)
/*
Post: The front of the Queue is removed and reported
in item. If the Queue
is empty return an Error_code
of underflow and leave the Queue unchanged.
*/
{
	if (front == NULL) return underflow;
	Node *old_front = front;
	item = old_front->entry;
	front = old_front->next;
	if (front == NULL) rear = NULL;
	delete old_front;
	return success;
}
bool Extended_queue::full() const
{
	return false;
}
void Extended_queue::clear()
{
	while (!empty())
		serve();
}
int Extended_queue::size() const
/*
Post: Return the number of entries in the Extended_queue.
*/
{
	Node *window = front;
	int count = 0;
	while (window != NULL) {
		window = window->next;
		count++;
	}
	return count;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -