kwest87

Untitled

Apr 19th, 2022
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. [StartCode]
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApp17
  9. {
  10.     internal class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             Queue<int> purchases = new Queue<int>();
  15.             purchases.Enqueue(5);
  16.             purchases.Enqueue(6);
  17.             purchases.Enqueue(7);
  18.             purchases.Enqueue(8);
  19.             purchases.Enqueue(9);
  20.             int storeMoney = 0;
  21.  
  22.             while(purchases.Count > 0)
  23.             {
  24.                 int purchaseMoney = purchases.Dequeue();
  25.                 storeMoney += purchaseMoney;
  26.                 ShowCashier(storeMoney);
  27.             }
  28.         }
  29.  
  30.         static void ShowCashier(int storeMoney)
  31.         {
  32.             Console.SetCursorPosition(0, 0);
  33.             Console.Write("В кассе " + storeMoney + " рублей . Нажмите любую клавишу для продолжения.");
  34.             Console.ReadKey();
  35.         }
  36.     }
  37. }
  38. [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment