Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace Supermarket
  5. {
  6. class Program
  7. {
  8.  
  9. static void Main(string[] args)
  10. {
  11. var quue = new Queue<string>();
  12. int counter = 0;
  13. string[] array = new string[] { " " };
  14.  
  15. while (true)
  16. {
  17. string input = input = Console.ReadLine();
  18. if (input == "Paid")
  19. {
  20. array = quue.ToArray();
  21. quue.Clear();
  22. counter = 0;
  23. }
  24.  
  25. else if (input == "End")
  26. {
  27. break;
  28. }
  29.  
  30. else
  31. {
  32. quue.Enqueue(input);
  33. counter++;
  34. }
  35. }
  36.  
  37. foreach (var name in array)
  38. {
  39. Console.WriteLine(name);
  40. }
  41.  
  42. Console.WriteLine($"{counter} people remaining");
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement