Advertisement
Rodunskiy

Untitled

May 10th, 2025
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. namespace CSLight
  2. {
  3.     public class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             Queue<int> buyers = new Queue<int>();
  8.  
  9.             buyers.Enqueue(1);
  10.             buyers.Enqueue(5);
  11.             buyers.Enqueue(3);
  12.             buyers.Enqueue(4);
  13.             buyers.Enqueue(2);
  14.  
  15.             int bank = 0;
  16.  
  17.             while (buyers.Count > 0)
  18.             {
  19.                 int currentPayment = buyers.Dequeue();
  20.  
  21.                 bank += currentPayment;
  22.  
  23.                 Console.WriteLine($"Клиент у кассы. Он заплатил: {currentPayment}. В кассе: {bank}");
  24.                 Console.WriteLine("Нажмите любую клавишу...");
  25.                 Console.ReadKey();
  26.                 Console.Clear();
  27.             }
  28.  
  29.             Console.WriteLine("Все клиенты обслужены!");
  30.         }
  31.     }
  32. }
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement