-
-
Save StrikerXx798/5bfde1ca64f743229b5b7fdc6e12ed8e to your computer and use it in GitHub Desktop.
ДЗ: Очередь в магазине
This file contains 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; | |
using System.Text; | |
namespace ConsoleApp1 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.InputEncoding = Encoding.Unicode; | |
Console.OutputEncoding = Encoding.Unicode; | |
Queue<int> clients = new Queue<int>(new int[] { 100, 200, 300, 400, 500 }); | |
int accountBalance = 0; | |
while (clients.Count > 0) | |
{ | |
Console.Clear(); | |
Console.WriteLine($"Текущий баланс: {accountBalance} руб."); | |
Console.WriteLine($"Сумма покупки клиента: {clients.Peek()} руб."); | |
Console.WriteLine("Нажмите любую клавишу для обслуживания клиента..."); | |
Console.ReadKey(true); | |
accountBalance += clients.Dequeue(); | |
} | |
Console.Clear(); | |
Console.WriteLine($"Все клиенты обслужены. Итоговый баланс: {accountBalance} руб."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment