Guest User

Untitled

a guest
Sep 16th, 2020
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace Supermarket
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. string command = Console.ReadLine();
  12. Queue<string> people = new Queue<string>();
  13. List<string> names = new List<string>();
  14.  
  15. while (command != "End")
  16. {
  17.  
  18.  
  19. if (command != "Paid")
  20. {
  21. people.Enqueue(command);
  22.  
  23. }
  24. else if (command == "Paid")
  25. {
  26.  
  27. for (int i = 0 - 1; i <= people.Count; i++)
  28. {
  29. string str = people.Dequeue();
  30. names.Add(str);
  31. }
  32.  
  33. }
  34.  
  35. command = Console.ReadLine();
  36. }
  37. foreach (string namez in names)
  38. {
  39. Console.WriteLine(namez);
  40. }
  41.  
  42. Console.WriteLine(people.Count + " people remaining.");
  43. }
  44. }
  45. }
Add Comment
Please, Sign In to add comment