W1thr

Коллекции-2

Mar 6th, 2021 (edited)
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 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 Homework2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Queue<int> clients = new Queue<int>();
  14.             int money = 0;
  15.             clients.Enqueue(123);
  16.             clients.Enqueue(34234);
  17.             clients.Enqueue(9231);
  18.             clients.Enqueue(1300);
  19.             clients.Enqueue(225);
  20.  
  21.             while (clients.Count > 0)
  22.             {
  23.                 Console.WriteLine("Сейчас обслуживается клиент с покупкой на " + clients.Peek() + " рублей. " + "Вы заработали " + money);
  24.                 Console.WriteLine("Осталось клиентов:" + clients.Count);
  25.                 Console.WriteLine("Нажмите любую клавишу, чтобы обслужить...");
  26.                 Console.ReadKey();
  27.                 money += clients.Dequeue();
  28.                 Console.Clear();
  29.             }
  30.         }
  31.     }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment