queue.cpp
来自「在Linux底下用QtDesigner开发的一个进程同步例子。基本思想是设计一个」· C++ 代码 · 共 38 行
CPP
38 行
#include "queue.h"HQueue::HQueue(int sz):rear(0),front(0),m(sz){//tag(0),//structure function,to create a empty Queue that have the max size of m Q =new Circle[m]; //create Queue space Q_ASSERT (Q != 0 ); //if(Q==0) //return; //assert:if the alloc storage succeed }void HQueue::EnQueue(Circle& item){//insert function //assert(!IsFull()); Q_ASSERT(!IsFull()); rear = (rear + 1) % m; // Q[rear] = item; // //tag = 1; }Circle HQueue::DeQueue(){// //assert(!IsEmpty()); Q_ASSERT(!IsEmpty()); front = (front + 1) % m; // //tag = 0; // return Q[front]; }Circle HQueue::GetFront(){// Q_ASSERT(!IsEmpty()); // return Q[(front + 1) % m] ; }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?