diff --git a/works/lab-05/readme.md b/works/lab-05/readme.md new file mode 100644 index 0000000..8918cba --- /dev/null +++ b/works/lab-05/readme.md @@ -0,0 +1,61 @@ + internal class Program + { + static void Main(string[] args) + { + //z1 + int pokemonHp = 20; + Console.WriteLine("\n=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ==="); + Console.WriteLine("Текущее здоровье покемона: " + pokemonHp); + HealPokemon(ref pokemonHp); + Console.ReadKey(); + + //z2 + Console.WriteLine("\n=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ==="); + Console.WriteLine("Вы зашли в траву............."); + string pkmnName; + int pkmnLevel; + SearchBushes(out pkmnName, out pkmnLevel); + Console.ReadKey(); + + //z3 + Console.WriteLine("\n=== РЕГИСТРАЦИЯ НА ТУРНИР ==="); + string[] pokemons1 = { "Бульбазавр", "Чармандер" }; + string[] pokemons2 = { "Сквиртл", "Пикачу", "Псайдак", "Мяут" }; + double difficultyReg = 1.5; + RegisterTournament(in difficultyReg, pokemons1); + Console.WriteLine("--------------------------------------"); + RegisterTournament(in difficultyReg, pokemons2); + Console.ReadKey(); + } + static void HealPokemon(ref int pkmnHp) + { + pkmnHp += 80; + if (pkmnHp > 100) + { + pkmnHp = 100; + Console.WriteLine($"[Покецентр] Покемон полностью здоров. Текущее хп: {pkmnHp}"); + } + else + { + Console.WriteLine("[Покецентр] Текущее хп после лечения " + pkmnHp); + } + } + static void SearchBushes(out string foundPokemon, out int pokemonlevel) + { + Random randomnum = new Random(); + pokemonlevel = randomnum.Next(1, 15); + foundPokemon = "Пикачу"; + Console.WriteLine($"Шорох!! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonlevel})!"); + + } + static void RegisterTournament(in double difficulty, params string[] participants) + { + //difficulty = 1,3; + Console.WriteLine("Коэффициент стадиона: " + difficulty); + Console.WriteLine("Список участников: "); + foreach (string pokemon in participants) + { + Console.WriteLine($"* {pokemon}"); + } + } + } \ No newline at end of file