Advertisement
Vlad_Savitskiy

Queue

Jun 28th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace CSLight
  5. {
  6.     class Program
  7.     {
  8.         private static void Main()
  9.         {
  10.             Queue<int> queue = new Queue<int>(new[] { 123, 234, 345, 656, 44, 7567, 867, 768, 435, 423 });
  11.             int sum = 0;
  12.  
  13.             while (queue.Count > 0)
  14.             {
  15.                 int clientSum = queue.Dequeue();
  16.                 Console.WriteLine($"Сумма на счету: {sum} руб.\n" +
  17.                                   $"Сумма покупки клиента: {clientSum}");
  18.                 sum += clientSum;
  19.  
  20.                 Console.ReadKey();
  21.                 Console.Clear();
  22.             }
  23.  
  24.             Console.WriteLine($"За этот день вам удалось заработать {sum} руб.");
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement