Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace C_Sharp_Junior
- {
- class Program
- {
- static void Main(string[] args)
- {
- int balanc = 0;
- Queue<int> clients = new Queue<int>();
- clients.Enqueue(20);
- clients.Enqueue(16);
- clients.Enqueue(5);
- clients.Enqueue(8);
- clients.Enqueue(55);
- ClientService(clients, balanc);
- Console.WriteLine("Все клиенты обслужены");
- Console.Write($"Мой счёт: {balanc} монет!");
- Console.ReadKey();
- }
- static void ClientService(Queue<int> clients, int balanc)
- {
- while (clients.Count > 0)
- {
- foreach (int Сlient in clients)
- {
- Console.WriteLine(Сlient);
- }
- Console.WriteLine("Идёт обслуживание клиента...");
- balanc += clients.Dequeue(); ;
- Console.WriteLine("Клиент обслужен");
- Console.Write($"Мой счёт: {balanc} монет!");
- Console.ReadLine();
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement