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("============================="); + } +}