GPbl3YH

CSLight #25

Feb 3rd, 2021 (edited)
646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CSLight
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int balance = 0;
  14.             Queue<int> clients = new Queue<int>();
  15.             clients.Enqueue(23);
  16.             clients.Enqueue(12);
  17.             clients.Enqueue(47);
  18.             clients.Enqueue(89);
  19.             clients.Enqueue(17);
  20.             bool isNotQueueEmpty = clients.Count > 0;
  21.  
  22.             while (isNotQueueEmpty)
  23.             {
  24.                 Console.Clear();
  25.                 Console.WriteLine($"Ваш баланс - {balance}");
  26.                 Console.WriteLine($"Выполняется транзакция на сумму - {clients.Peek()}");
  27.                 balance += clients.Dequeue();
  28.                 Console.ReadKey();
  29.             }
  30.  
  31.             Console.WriteLine($"\n-----------------\n\nИтого: {balance}");
  32.             Console.ReadKey();
  33.         }
  34.     }
  35. }
Add Comment
Please, Sign In to add comment