From ed86c8c391a32b2579a44aadfbdc390165cdcdd4 Mon Sep 17 00:00:00 2001 From: ananesicim Date: Thu, 26 Nov 2026 17:48:23 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20works=20=D1=81#/lab=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works с#/lab 5 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 works с#/lab 5 diff --git a/works с#/lab 5 b/works с#/lab 5 new file mode 100644 index 0000000..4b3c2ba --- /dev/null +++ b/works с#/lab 5 @@ -0,0 +1,50 @@ +using System; + +class Program +{ + static void HealPokemon(ref int hp) + { + hp += 80; + Console.WriteLine("[Покецентр] Покемон полностью здоров! Восстановлено 80 HP."); + } + + static void SearchBushes(out string foundPokemon, out int pokemonLevel) + { + Random random = new Random(); + foundPokemon = "Пикачу"; + pokemonLevel = random.Next(1, 16); + } + + static void RegisterTournament(in double difficulty, params string[] participants) + { + Console.WriteLine($"Коэффициент стадиона: {difficulty}"); + Console.WriteLine("Список участников:"); + foreach (string participant in participants) + { + Console.WriteLine($" * {participant}"); + } + } + + static void Main() + { + Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ==="); + int pokemonHP = 20; + Console.WriteLine($"Здоровье до лечения: {pokemonHP} HP."); + HealPokemon(ref pokemonHP); + Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP."); + + Console.WriteLine(); + Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ==="); + Console.WriteLine("Вы зашли в высокую траву..."); + SearchBushes(out string foundPokemon, out int pokemonLevel); + Console.WriteLine($"Шорох! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonLevel})!"); + + Console.WriteLine(); + Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ==="); + double stadiumDifficulty = 1.5; + RegisterTournament(in stadiumDifficulty, "Булбазавр", "Чармандер"); + Console.WriteLine("-----------------------------"); + RegisterTournament(in stadiumDifficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут"); + Console.WriteLine("============================="); + } +}