# Include <iostream> using namespace std; # define MaxSize 50 typedef char ElemType; typedef struct {ElemType data [MaxSize]; int front, rear;} SqQueue; void InitQueue (SqQueue * & q) {q = (SqQueue *) malloc (sizeof (SqQueue); q-> front = q-> rear = 0 ;} void ClearQueue (SqQueue * & q) {free (q);} int QueueEmpty (SqQueue * & q) {return (q-> rear = q-> front );} int enQueue (SqQueue * & q, ElemType e) {if (q-> rear + 1% MaxSize = q-> front) // return 0 when the team is full; q-> rear = (q-> rear + 1) % MaxSize; q-> data [q-> rear] = e; return 1 ;} int deQueue (SqQueue * & q, ElemType & e) {if (q-> rear = q-> front) // empty team return 0; q-> front = (q-> front + 1) % MaxSize; e = q-> data [q-> front]; return 1;} void main () {ElemType e = '0'; SqQueue * q; cout <"initialize queue;" <endl; InitQueue (q); cout <"determines whether the queue is empty: "; if (QueueEmpty (q) cout <" null; "<endl; elsecout <" not empty; "<endl; cout <" add element, b, c: "<endl; enQueue (q, 'A'); enQueue (q, 'B'); enQueue (q, 'C '); deQueue (q, e); cout <"Departure element:" <e <endl; ClearQueue (q );}