Обновить works/sharp/lab-05/Program.cs

This commit is contained in:
zxc
2026-09-30 08:57:52 +00:00
parent 9b0d875501
commit a992842928
+15 -17
View File
@@ -13,6 +13,14 @@ using System;
Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP."); Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP.");
Console.WriteLine(); Console.WriteLine();
static void HealPokemon(ref int hp)
{
hp += 80;
Console.WriteLine($"[Покецентр] Покемон полностью здоров! Восстановлено 80 HP.");
Console.WriteLine($"[Покецентр] Покемон полностью здоров! Восстановлено {healed} HP.");
}
// ЗАДАНИЕ 2 // ЗАДАНИЕ 2
Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ==="); Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
Console.WriteLine("Вы зашли в высокую траву..."); Console.WriteLine("Вы зашли в высокую траву...");
@@ -20,6 +28,13 @@ using System;
Console.WriteLine($"Шорох! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonLevel})!"); Console.WriteLine($"Шорох! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonLevel})!");
Console.WriteLine(); Console.WriteLine();
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
{
Random rnd = new Random();
foundPokemon = "Пикачу";
pokemonLevel = rnd.Next(1, 16);
}
// ЗАДАНИЕ 3 // ЗАДАНИЕ 3
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ==="); Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
double difficulty = 1.5; double difficulty = 1.5;
@@ -31,23 +46,6 @@ using System;
Console.ReadLine(); Console.ReadLine();
} }
// ЗАДАНИЕ 1
static void HealPokemon(ref int hp)
{
int healed = 100 - hp;
hp = 100;
Console.WriteLine($"[Покецентр] Покемон полностью здоров! Восстановлено {healed} HP.");
}
// ЗАДАНИЕ 2
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
{
Random rnd = new Random();
foundPokemon = "Пикачу";
pokemonLevel = rnd.Next(1, 16);
}
// ЗАДАНИЕ 3
static void RegisterTournament(in double difficulty, params string[] participants) static void RegisterTournament(in double difficulty, params string[] participants)
{ {