Advertisement
JohnJuly

Homework34

Feb 24th, 2024 (edited)
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using Microsoft.Win32;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace Homework34
  10. {
  11.     internal class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             Queue<int> buyers = new Queue<int>(5);
  16.  
  17.             buyers.Enqueue(5);
  18.             buyers.Enqueue(6);
  19.             buyers.Enqueue(7);
  20.             buyers.Enqueue(89);
  21.             buyers.Enqueue(8);
  22.  
  23.             int moneyInСashRegister = 0;
  24.  
  25.             while (buyers.Count > 0)
  26.             {
  27.                 Console.WriteLine("Клиентов в очереди осталось: " + buyers.Count);
  28.                 Console.WriteLine("Нажмите любую кнопку чтобы обслужить клиента");
  29.                 Console.WriteLine("Денег в кассе: " + moneyInСashRegister);
  30.  
  31.                 moneyInСashRegister += buyers.Dequeue();
  32.  
  33.                 Console.ReadKey();
  34.                 Console.Clear();
  35.             }
  36.  
  37.             if (buyers.Count == 0)
  38.             {
  39.                 Console.WriteLine("Очередь пуста!!!");
  40.             }
  41.         }
  42.     }
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement