Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace Supermarket
- {
- class Program
- {
- static void Main(string[] args)
- {
- string command = Console.ReadLine();
- Queue<string> people = new Queue<string>();
- List<string> names = new List<string>();
- while (command != "End")
- {
- if (command != "Paid")
- {
- people.Enqueue(command);
- }
- else if (command == "Paid")
- {
- for (int i = 0 - 1; i <= people.Count; i++)
- {
- string str = people.Dequeue();
- names.Add(str);
- }
- }
- command = Console.ReadLine();
- }
- foreach (string namez in names)
- {
- Console.WriteLine(namez);
- }
- Console.WriteLine(people.Count + " people remaining.");
- }
- }
- }
Add Comment
Please, Sign In to add comment