Created
November 23, 2025 17:25
-
-
Save Attosius/ce10479c7ab4705f9b0143da3122ffd5 to your computer and use it in GitHub Desktop.
ДЗ: Очередь в магазине
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| namespace IJuniorTasks | |
| { | |
| internal class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var purchasesSums = new Queue<int>(); | |
| purchasesSums.Enqueue(1); | |
| purchasesSums.Enqueue(10); | |
| purchasesSums.Enqueue(7); | |
| purchasesSums.Enqueue(3); | |
| int accountSum = 0; | |
| while (purchasesSums.TryDequeue(out var purchaseSum)) | |
| { | |
| accountSum += purchaseSum; | |
| Console.WriteLine($"Обслужен клиент с суммой {purchaseSum}. Общая сумма аккаунта {accountSum}"); | |
| Console.WriteLine($"\n\nНажмите любую клавишу для продолжения"); | |
| Console.ReadLine(); | |
| Console.Clear(); | |
| } | |
| Console.WriteLine($"Обслужены все клиенты. Общая сумма аккаунта {accountSum}"); | |
| Console.ReadLine(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment