Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace CSLight
- {
- internal class Program
- {
- static void Main()
- {
- Queue<int> clients = new Queue<int>();
- int minValue = 10;
- int maxValue = 50;
- int purchaseAmount;
- Random random = new Random();
- int totalAmount = 0;
- int clientsInQueue = 5;
- for (int i = 0; i < clientsInQueue; i++)
- {
- clients.Enqueue(i + 1);
- }
- while (clients.Count != 0)
- {
- purchaseAmount = random.Next(minValue, maxValue);
- Console.WriteLine($"Сейчас в очереди {clients.Dequeue()} клиент");
- Console.Write("\nСумма покупки: " + purchaseAmount);
- Console.Write("\nОбщая сумма: " + totalAmount);
- totalAmount += purchaseAmount;
- Console.ReadKey();
- Console.Clear();
- }
- Console.Write("Клиентов больше нет. Итоговая общая сумма: " + totalAmount + "\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement