Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Store
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- Queue<int> cutomerAmounts = new Queue<int>();
- int purse = 0;
- for(int i = 0; i < random.Next(20, 101); i++)
- {
- cutomerAmounts.Enqueue(random.Next(50, 301));
- }
- while(cutomerAmounts.Count > 0)
- {
- int currentCustomerAmount = cutomerAmounts.Dequeue();
- purse += currentCustomerAmount;
- Console.Write("Идет обслуживание клиента...\n" +
- "Вам заплатили " + currentCustomerAmount + " денег\n" +
- "Текущий счет: " + purse + "\n" +
- "Нажмите любую клавишу, чтобы обслужить следующего клиента");
- Console.ReadKey();
- Console.Clear();
- }
- Console.WriteLine("Это был последний клиент, вы заработали " + purse + " денег");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement