队列的顺序存储_#define
队列的顺序存储_#include_02

队列的顺序存储_#include_03

rear 指向实际的队列中元素
front指向前一个 当二者相等
相等 空or满?
队列的顺序存储_C_04

#include <iostream>
using namespace std;
#define maxsize 100
typedef int elementtype;
struct qnode
{
	elementtype data[maxsize];
	int rear;
	int front;
};
typedef struct qnode *queue;
//入队列
void addq(queue ptrq, elementtype item)
{
	if ((ptrq->rear+1)%maxsize == ptrq->front)
	{
		cout << "man" << endl;
		return;
	}
	ptrq->rear = (ptrq->rear + 1) % maxsize;
	ptrq->data[ptrq->rear] = item;
}
//出队列
elementtype deleteq(queue ptrq)
{
	if (ptrq->front == ptrq->rear)
	{
		cout << "kong";
		return -1;
	}
	else
	{
		ptrq->front = (ptrq->front + 1) % maxsize;
		return ptrq->data[ptrq->front];
	}
}