Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var q = new Queue();

            q.Push(1);
            q.Push(2);
            q.Push(3);
            q.Push(4);
            q.Push(5);

            Console.WriteLine(q.Peek());

            Console.WriteLine(q.Pop());
            Console.WriteLine(q.Pop());

            Console.ReadKey();
        }
        private static void VerifyQueue()
        {
            Console.WriteLine("Queue");
            Queue <string> que = new Queue <string>();

            Console.WriteLine("------");
            que.Push("Item1");
            que.Push("Item2");
            que.Push("Item3");

            Console.WriteLine("Pushed Items");
            que.ReadAll();
            Console.WriteLine("------");

            Console.WriteLine("Poped Item");
            var popedItem = que.Pop();

            Console.WriteLine(popedItem);
            Console.WriteLine("------");
            que.ReadAll();
            Console.WriteLine("------");
            Console.WriteLine("Poped Item");
            popedItem = que.Pop();
            Console.WriteLine(popedItem);
            Console.WriteLine("------");
            que.ReadAll();
            Console.WriteLine("------");
            Console.WriteLine("Poped Item");
            popedItem = que.Pop();
            Console.WriteLine(popedItem);
            Console.WriteLine("------");
            que.ReadAll();
            Console.WriteLine("------");
            Console.WriteLine("Poped Item");
            popedItem = que.Pop();
            Console.WriteLine(popedItem);
            que.ReadAll();
            Console.WriteLine("------");


            Console.ReadKey();
        }