Esempio n. 1
0
        static void Main(string[] args)
        {
            MyQueue <int> myQueue = new MyQueue <int>();

            myQueue.Enqueue(1);
            myQueue.Enqueue(3);
            myQueue.Enqueue(4);
            myQueue.Enqueue(5);
            myQueue.Enqueue(6);
            myQueue.Enqueue(7);
            myQueue.Enqueue(8);
            Console.WriteLine("Queue - {0}", myQueue.ToString());
            Console.WriteLine("Operation Dequeue - {0}", myQueue.Dequeue());
            Console.WriteLine("Operation Peek - {0}", myQueue.Peek());
            Console.WriteLine("Queue - {0}", myQueue.ToString());
            Console.WriteLine("Count - {0}", myQueue.Count());
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Queue <int> queue = new Queue <int>();

            queue.Enqueue(5);
            queue.Enqueue(6);
            queue.Enqueue(7);
            queue.Enqueue(8);

            Console.WriteLine(queue.Peek());

            Console.WriteLine("---------------");

            MyQueue <int> myQueue = new MyQueue <int>();

            myQueue.Enqueue(5);
            myQueue.Enqueue(6);
            myQueue.Enqueue(7);
            myQueue.Enqueue(8);

            Console.WriteLine(myQueue.Peek());
        }