Skip to content

Instantly share code, notes, and snippets.

@MrTrigraf
Created June 23, 2025 10:50
Show Gist options
  • Save MrTrigraf/ff6136c53673955231c06c1f8eaf1fac to your computer and use it in GitHub Desktop.
Save MrTrigraf/ff6136c53673955231c06c1f8eaf1fac to your computer and use it in GitHub Desktop.
ДЗ: Очередь в магазине
using System;
using System.Collections.Generic;
namespace ConsoleApp4
{
internal class Program
{
static void Main(string[] args)
{
Queue<int> shoppingСart = new Queue<int>(new[] { 100, 165, 200, 234, 300, 378, 400});
int moneyStore = 0;
while (shoppingСart.Count > 0)
{
Console.WriteLine("Стоимость товаров: " + shoppingСart.Peek());
Console.WriteLine("Деньги в магазине: " + moneyStore);
moneyStore += shoppingСart.Dequeue();
Console.Write("Для перехода к следующему клиенту нажмите любую клавишу: ");
Console.ReadKey();
Console.Clear();
}
Console.WriteLine("Клиенты закончились. Деньги в магазине: " + moneyStore);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment