示例#1
0
        /// <summary>
        /// 初始化并运行简单自定义队列
        /// </summary>
        public static void BuildAndRunQueue()
        {
            MyQueue queue = new MyQueue();

            queue.EnQueue(1);
            queue.EnQueue(2);
            queue.EnQueue(3);
            queue.EnQueue(4);
            queue.EnQueue(5);
            queue.EnQueue(6);

            for (int i = 0; i < 8; i++)
            {
                queue.DeQueue();
                if (!queue.IsEmpty())
                {
                    Console.WriteLine(queue.Front());
                }
                else
                {
                    Console.WriteLine("队列为空!");
                }
            }
        }