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

📄 qtype.cpp

📁 此文件可以能帮你求体积
💻 CPP
字号:
// QType.cpp: implementation of the QType class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "QType.h"
#include <iostream.h>

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

QType::QType()
: head(0), tail(0)
{

}

QType::~QType()
{

}

int QType::Fetch()
{
	if (head == tail)
	{
		cout << "Queue is empty\n";
		return 0;
	}

	head = (head+1)%SIZE;
	return queue[head];
}

void QType::Store(int num)
{
	if ( (tail+1) % SIZE == head )
	{
		cout << "Queue is full\n";
		return;
	}

	tail = (tail+1)%SIZE;
	queue[tail] = num;
}

⌨️ 快捷键说明

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