main.cpp
#include <iostream>
#include "CirQueue.h"
using namespace std;
int main() {
try{
CirQueue<int> Q(4);
Q.enQueue(1);
Q.enQueue(2);
Q.enQueue(3);
//Q.enQueue(4); 为什么会出现这种现象?不理解
//队列为空 队列的长度为:0
//Queue.clearQueue();
Q.displayQueue();
cout << "队列的长度为:" << Q.queueLength();
}
catch (CirQueue<int>::Out_of_range)
{
cout<<"队列已满"<<endl;
}
catch (CirQueue<int>::Empty) {
cout<<"队列为空"<<endl;
}
return 0;
}
CirQueue.cpp
//
// Created by 63400 on 2021/11/7.
//
#include <iostream>
#include "CirQueue.h"
using namespace std;
const int QUEUESIZE = 100