Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- Queue<int> costProducts = new Queue<int>();
- FillQueue(costProducts);
- DrawQueue(costProducts);
- }
- private static void DrawQueue(Queue<int> costProducts)
- {
- int balance = 0;
- while (costProducts.Count > 0)
- {
- Console.Clear();
- Console.WriteLine($"На балансе: {balance}. Нажмите любую клавишу, чтобы обслужить клиента...\n");
- Console.ReadKey();
- Console.WriteLine("\nДеньги зачислены на счёт!");
- balance += costProducts.Dequeue();
- Console.ReadKey();
- Console.Clear();
- Console.WriteLine($"Клиентов больше нету!\nВыручка составляет: {balance} рублей");
- }
- }
- private static void FillQueue(Queue<int> costProducts)
- {
- int countOfBuyers = 10;
- int maxCost = 1000;
- int minCost = 5;
- Random random = new Random();
- for (int i = 0; i < countOfBuyers; i++)
- {
- costProducts.Enqueue(random.Next(minCost, maxCost));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement