#includeusing namespace std;struct Queue{ int maxCnt; int* elements; int front,rear;};Queue* createQueue(int max=7){ Queue* queue = (Queue*)malloc(sizeof(Queue)); queue->front=0; queue->rear=0; queue->maxCnt=max+1;//预留一个空间来预防假溢出的情况 queue->elements = new int[ queue->maxCnt]; return queue;}bool isFull(Queue* queue){ return ((queue->rear+1)%queue->maxCnt)==queue->front;}bool isEmpty(Queue* queue){ return queue->rear==queue->front;} bool InQueue(Queue* queue,int value){ if(isFull(queue)) return 0; queue->elements[queue->rear++]=value; queue->rear%=queue->maxCnt; return 1;}bool DeQueue(Queue* queue,int* ans){ if(isEmpty(queue)) return 0; *ans = queue->elements[queue->front++]; queue->front%=queue->maxCnt; return 1;}bool front(Queue* queue,int* ans){ if(isEmpty(queue)) return 0; *ans = queue->elements[queue->front]; return 1;}void clearQueue(Queue* queue){ int x; while(!isEmpty(queue)) { DeQueue(queue,&x); cout< <<" "; } cout< front; int ed = queue->rear; while(st!=ed) { cout< elements[st]<<" "; st++; st%=queue->maxCnt; } cout< >len;}