Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CollectionsTask2Queue
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Queue<int> clientsMoney = new Queue<int>();
- int clientMoney;
- int ourMoney = 0;
- Random random = new Random();
- for (int i = 0; i < 10; i++)
- {
- clientsMoney.Enqueue(random.Next(0, 10000));
- }
- while(clientsMoney.Count > 0)
- {
- Console.Clear();
- clientMoney = clientsMoney.Dequeue();
- Console.WriteLine($"Следующий клиент совершает покупку на {clientMoney} монет.");
- ourMoney += clientMoney;
- Console.WriteLine($"В кассе магазина теперь {ourMoney} монет.");
- Console.ReadKey();
- }
- Console.WriteLine($"Покупателей больше нет.");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement