public class cricularqueue//循环队列 { string[] queues; int head = 0; int rear = 0; public cricularqueue() { queues=new string[10]; } public cricularqueue(int Length) { queues = new string[Length]; } public bool Empty()//循环队列空 { if (head == rear) { return true; } else return false; } public bool Full()//循环队列满 { if ((rear + 1) % queues.Length == head) { return true; } else return false; } public void Enter(string Val)//进队列 { if(!Full()) { queues[rear] = Val; rear = (rear + 1) % queues.Length; } } public string OutQueue()//出队列 { string Val = ""; if(!Empty()) { Val = queues[head]; head=(head+1)%queues.Length; return Val; } return Val; } public int GetLength() { return (rear+queues.Length-head)%queues.Length; } }