Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Supermarket
- {
- class Program
- {
- static void Main(string[] args)
- {
- var quue = new Queue<string>();
- int counter = 0;
- string[] array = new string[] { " " };
- while (true)
- {
- string input = input = Console.ReadLine();
- if (input == "Paid")
- {
- array = quue.ToArray();
- quue.Clear();
- counter = 0;
- continue;
- }
- else if (input == "End")
- {
- break;
- }
- else
- {
- quue.Enqueue(input);
- counter++;
- }
- }
- foreach (var name in array)
- {
- Console.WriteLine(name);
- }
- Console.WriteLine($"{counter} people remaining");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement