From a570428d62c53813c8ab042b2a2df3137caf1910 Mon Sep 17 00:00:00 2001 From: Katy328 Date: Wed, 7 Oct 2026 10:49:34 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?works/lab-05=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works/lab-05/Program (2).cs | 85 +++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 works/lab-05/Program (2).cs diff --git a/works/lab-05/Program (2).cs b/works/lab-05/Program (2).cs new file mode 100644 index 0000000..bcf0de5 --- /dev/null +++ b/works/lab-05/Program (2).cs @@ -0,0 +1,85 @@ +using System; + +namespace PokemonTournamentApp +{ + class Program + { + static void Main(string[] args) + { + + Console.OutputEncoding = System.Text.Encoding.UTF8; + Console.InputEncoding = System.Text.Encoding.UTF8; + + + + 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 tournamentDifficulty = 1.5; + + + RegisterTournament(in tournamentDifficulty, "Булбазавр", "Чармандер"); + Console.WriteLine("-----------------------------"); + + + RegisterTournament(in tournamentDifficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут"); + Console.WriteLine("============================="); + + + Console.ReadKey(); + } + + + 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) + { + // Демонстрация работы in: + // difficulty = 2.0; // ОШИБКА КОМПИЛЯЦИИ! Менять in-параметры нельзя (только для чтения). + + Console.WriteLine($"Коэффициент стадиона: {difficulty:F1}"); + Console.WriteLine("Список участников:"); + + + foreach (string pokemon in participants) + { + Console.WriteLine($" * {pokemon}"); + } + } + } +}