templateclass SeqQueue{public: SeqQueue(int sz):m_nrear(0),m_nfront(0),m_ncount(0),m_nMaxSize(sz){ m_pelements=new Type[sz]; if(m_pelements==NULL){ cout<<"Application Error!"< void SeqQueue ::MakeEmpty(){ this->m_ncount=0; this->m_nfront=0; this->m_nrear=0;}template bool SeqQueue ::IsEmpty(){ return m_ncount==0;}template bool SeqQueue ::IsFull(){ return m_ncount==m_nMaxSize;}template bool SeqQueue ::Append(const Type item){ if(IsFull()){ cout<<"The queue is full!"< Type SeqQueue ::Delete(){ if(IsEmpty()){ cout<<"There is no element!"< Type SeqQueue ::Get(){ if(IsEmpty()){ cout<<"There is no element!"< void SeqQueue ::Print(){ cout<<"front"; for(int i=0;i "< rear"< < <
#includeusing namespace std;#include "SeqQueue.h"int main(){ SeqQueue queue(10); int init[10]={1,6,9,0,2,5,8,3,7,4}; for(int i=0;i<5;i++){ queue.Append(init[i]); } queue.Print(); cout< <
==============================================================================
本文转自被遗忘的博客园博客,原文链接:http://www.cnblogs.com/rollenholt/archive/2012/04/08/2438203.html,如需转载请自行联系原作者