Advertisement
jtentor

DemoQueue3 - Program.cs

May 18th, 2020
871
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DemoQueue3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Demo Queue - versión genérica - Caso Ejemplo b)");
  14.             SpecialQueue<int> queue1 = new SpecialQueue<int>();
  15.  
  16.             Random random = new Random();
  17.  
  18.             int number;
  19.             Console.WriteLine("Enqueuing...");
  20.             for (int c = 0; c < 10; ++c)
  21.             {
  22.                 queue1.Enqueue(number = random.Next(1, 11));
  23.                 Console.Write("{0} ", number);
  24.             }
  25.             Console.WriteLine();
  26.  
  27.             Console.WriteLine("Joining with same queue...");
  28.             SpecialQueue<int> queue2 = queue1.join(queue1);
  29.  
  30.  
  31.             Console.WriteLine("Dequeuing...");
  32.             while (queue1.Count > 0)
  33.             {
  34.                 Console.Write("{0} ", queue1.Dequeue());
  35.             }
  36.             Console.WriteLine();
  37.             Console.WriteLine("Dequeuing joined queue...");
  38.             while (queue2.Count > 0)
  39.             {
  40.                 Console.Write("{0} ", queue2.Dequeue());
  41.             }
  42.             Console.WriteLine();
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement