Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Collections
- {
- class Program
- {
- static void Main(string[] args)
- {
- Queue<int> clients = new Queue<int>();
- int balance = 0;
- clients.Enqueue(5);
- clients.Enqueue(7);
- clients.Enqueue(6);
- clients.Enqueue(12);
- clients.Enqueue(9);
- clients.Enqueue(8);
- clients.Enqueue(10);
- while (clients.Count > 0)
- {
- Console.WriteLine($"Баланс равен {balance} рублей");
- Console.ReadLine();
- Console.Clear();
- Console.WriteLine($"Клиент обслужен, баланс пополнился на {clients.Peek()} рублей");
- balance += clients.Dequeue();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment