问题:
/*
Copyright (c)2016,烟台大学计算机与控制工程学院
All rights reserved.
文件名称:项目1.cbp
作 者:程德泉
完成日期:2016年10月9日
版 本 号:v1.0
问题描述:定义顺序环形队列存储结构,实现其基本运算,并完成测试。
输入描述:无
程序输出:测试数据
*/
- sqqueue.h头文件代码
#ifndef SQQUEUE_H_INCLUDED
#define SQQUEUE_H_INCLUDED
#include <stdio.h>
#include <malloc.h>
#define MaxSize 5
typedef char ElemType;
typedef struct
{
ElemType data[MaxSize];
int front,rear; /*队首和队尾指针*/
} SqQueue;
void InitQueue(SqQueue *&q); //初始化顺序环形队列
void DestroyQueue(SqQueue *&q); //销毁顺序环形队列
bool QueueEmpty(SqQueue *q); //判断顺序环形队列是否为空
int QueueLength(SqQueue *q); //返回队列中元素个数,也称队列长度
bool enQueue(SqQueue *&q,ElemType