Guest User

Untitled

a guest
Feb 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace Cola
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. Queue<string> Cola = new Queue<string>();
  11. string Opcion = "";
  12. do {
  13. Console.WriteLine("Que desea hacer?");
  14. Console.WriteLine("0.Salir");
  15. Console.WriteLine("1.Agregar a la cola");
  16. Console.WriteLine("2.Eliminar de la cola");
  17. Console.WriteLine("3.Mostrar Elementos de la cola");
  18. Opcion = Console.ReadLine();
  19.  
  20. switch (Opcion)
  21. {
  22. case "1":
  23. {
  24. Console.WriteLine("Elemento a Introducir a la cola: ");
  25. Cola.Enqueue(Console.ReadLine());
  26. }
  27. break;
  28. case "2":
  29. {
  30. Console.WriteLine("Elemento Eliminado {0}", Cola.Dequeue());
  31. Console.WriteLine("Elemento Siguente {0}", Cola.Peek());
  32. }
  33. break;
  34. case "3":
  35. {
  36. Console.WriteLine("Elementso en la cola:");
  37. foreach (string C in Cola)
  38. {
  39. Console.WriteLine(C);
  40. }
  41. }
  42. break;
  43. }
  44. } while(Opcion!="0");
  45. }
  46. }
  47. }
Add Comment
Please, Sign In to add comment