From 98d2225407d070fe1877dfe881732a4a122637b6 Mon Sep 17 00:00:00 2001 From: alim Date: Thu, 26 Nov 2026 21:44:11 +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=20charp/labs=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works charp/labs 5 | 91 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 works charp/labs 5 diff --git a/works charp/labs 5 b/works charp/labs 5 new file mode 100644 index 0000000..26393e7 --- /dev/null +++ b/works charp/labs 5 @@ -0,0 +1,91 @@ +задание 1 +using System; + +class Program +{ + static void HealPokemon(ref int hp) + { + hp += 80; + + if (hp > 100) + { + hp = 100; + } + + Console.WriteLine("[Покецентр] Покемон прошел лечение!"); + } + + static void Main() + { + int pokemonHP = 20; + + Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ==="); + + Console.WriteLine("Здоровье до лечения: " + pokemonHP + " HP."); + + HealPokemon(ref pokemonHP); + + Console.WriteLine("Здоровье после лечения: " + pokemonHP + " HP."); + + Console.ReadKey(); + } +} +задание 2 +using System; + +class Program +{ + static void SearchBushes(out string foundPokemon, out int pokemonLevel) + { + Random random = new Random(); + + foundPokemon = "Пикачу"; + pokemonLevel = random.Next(1, 16); + } + + static void Main() + { + string pokemon; + int level; + + Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ==="); + Console.WriteLine("Вы зашли в высокую траву..."); + + SearchBushes(out pokemon, out level); + + Console.WriteLine("Шорох! Из кустов появляется дикий " + pokemon + "!"); + Console.WriteLine("Уровень покемона: " + level); + + Console.ReadKey(); + } +} +задание 3 +using System; + +class Program +{ + static void RegisterTournament(in double difficulty, params string[] participants) + { + Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ==="); + Console.WriteLine("Коэффициент стадиона: " + difficulty); + Console.WriteLine("Список участников:"); + + for (int i = 0; i < participants.Length; i++) + { + Console.WriteLine(" * " + participants[i]); + } + + Console.WriteLine("=============================="); + } + + static void Main() + { + double difficulty = 1.5; + + RegisterTournament(in difficulty, "Бульбазавр", "Чармандер"); + + RegisterTournament(in difficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут"); + + Console.ReadKey(); + } +} \ No newline at end of file