#include<iostream> using namespace std; const int MaxQsize=100; typedef int ElemType; struct SqQueue { ElemType *base; int front; int rear; void Init(); void clear(); bool Empty(); ElemType GetTop(); void EnQueue(ElemType e); void DeQueue(); }; void SqQueue::Init() { base=new ElemType[MaxQsize]; front=rear=0; } void SqQueue::clear() { front=rear=0; } bool SqQueue::Empty() { return front==(rear+1)%MaxQsize; } ElemType SqQueue::GetTop() { return base[front]; } void SqQueue::EnQueue(ElemType e) { if(front==(rear+1)%MaxQsize) return; base[rear]=e; rear=(rear+1)%MaxQsize; } void SqQueue::DeQueue() { if(front==rear) return; front=(front+1)%MaxQsize; } int main() { }