ranee

очередь

Apr 18th, 2021 (edited)
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace CSLight
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int numberOfClients, clientMoney ;
  11.             int storeProfit = 0;
  12.             Queue<int> amountOfPurchases = new Queue<int>();
  13.             amountOfPurchases.Enqueue(1);
  14.             amountOfPurchases.Enqueue(1);
  15.             amountOfPurchases.Enqueue(1);
  16.             amountOfPurchases.Enqueue(1);
  17.             amountOfPurchases.Enqueue(1);
  18.             amountOfPurchases.Enqueue(1);
  19.             numberOfClients = amountOfPurchases.Count;
  20.             for (int i = 0; i < numberOfClients; i++)
  21.             {
  22.                 clientMoney = amountOfPurchases.Dequeue();
  23.                 storeProfit += clientMoney;
  24.                 Console.WriteLine($"Прибыль магазина после обслуживания клиента: {storeProfit}");
  25.                 Console.ReadKey();
  26.                 Console.Clear();
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment