Advertisement
LeRoY_Go

Untitled

Feb 3rd, 2022
1,084
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace C_Sharp_Junior
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int balanc = 0;
  11.             Queue<int> clients = new Queue<int>();
  12.             clients.Enqueue(20);
  13.             clients.Enqueue(16);
  14.             clients.Enqueue(5);
  15.             clients.Enqueue(8);
  16.             clients.Enqueue(55);
  17.             ClientService(clients, balanc);
  18.             Console.WriteLine("Все клиенты обслужены");
  19.             Console.Write($"Мой счёт: {balanc} монет!");
  20.             Console.ReadKey();
  21.         }
  22.  
  23.         static void ClientService(Queue<int> clients, int balanc)
  24.         {
  25.             while (clients.Count > 0)
  26.             {
  27.                 foreach (int Сlient in clients)
  28.                 {
  29.                     Console.WriteLine(Сlient);
  30.                 }
  31.                 Console.WriteLine("Идёт обслуживание клиента...");
  32.                 balanc += clients.Dequeue(); ;
  33.                 Console.WriteLine("Клиент обслужен");
  34.                 Console.Write($"Мой счёт: {balanc} монет!");
  35.                 Console.ReadLine();
  36.                 Console.Clear();
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement