Ejemplo n.º 1
0
        public static void Main()
        {
            var testQueue = new MyQueue <string>();

            testQueue.Enqueue("One");
            testQueue.Enqueue("Two");
            testQueue.Enqueue("Four");
            Console.WriteLine(testQueue);
            Console.WriteLine("Removing: {0}", testQueue.Dequeue());
            ////Console.WriteLine("Removing: {0}", testQueue.Dequeue());
            Console.WriteLine(testQueue.Peek());

            Console.WriteLine(testQueue);
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            MyQueue testQueue = new MyQueue();

            testQueue.Enqueue("some item");
            testQueue.Enqueue(1);
            testQueue.Enqueue(1.24);

            Console.WriteLine(testQueue);

            var element = testQueue.Dequeue();

            while (element != null)
            {
                Console.WriteLine(element);
                element = testQueue.Dequeue();
            }
        }
Ejemplo n.º 3
0
        public static void Main()
        {
            var stack = new MyQueue<int>();
            stack.Enqueue(1);
            stack.Enqueue(2);
            stack.Enqueue(3);
            stack.Enqueue(4);
            stack.Enqueue(5);
            stack.Enqueue(6);
            stack.Enqueue(7);

            Console.WriteLine(string.Join(", ", stack));

            stack.Dequeue();
            stack.Dequeue();
            stack.Dequeue();
            stack.Dequeue();
            stack.Enqueue(7);
            stack.Dequeue();
            stack.Enqueue(7);

            Console.WriteLine(string.Join(", ", stack));
        }