Добавить works/charp/lab-05/lab05/Program.cs

This commit is contained in:
2026-11-24 17:19:44 +00:00
parent 2809b8eba8
commit dfd462f9f9
+43
View File
@@ -0,0 +1,43 @@
Console.WriteLine("=== ЗАДАНИЕ 1. ===");
int pokemonHp = 20;
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
Console.WriteLine($"Здоровье до лечения: {pokemonHp}.");
static void HealPokemon(ref int pokemonHp)
{
pokemonHp += 80;
Console.WriteLine("[Покецентр] Покемон полностью здоров! Восстановлено 80 HP.");
}
HealPokemon(ref pokemonHp);
Console.WriteLine($"Здоровье после лечения: {pokemonHp}.");
Console.WriteLine("\n=== ЗАДАНИЕ 2. ===");
Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
Console.WriteLine($"Вы зашли в высокую траву...");
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
{
foundPokemon = "Пикачу";
pokemonLevel = new Random().Next(1, 15);
}
SearchBushes(out string pokemonName, out int level);
Console.WriteLine($"Шорох! Из кустов появляется дикий {pokemonName}, (Уровень: {level})");
Console.WriteLine("\n=== ЗАДАНИЕ 3. ===");
static void RegisterTournament(in double difficulty, params string[] participants)
{
// difficulty = 2.0; // компилятор выдаст ошибку
Console.WriteLine($"Коэффициент стадиона: {difficulty}");
Console.WriteLine("Список участников:");
foreach (string pokemon in participants)
{
Console.WriteLine($"* {pokemon}");
}
}
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
RegisterTournament(1.5, "Бульбазавр", "Чармандер");
Console.WriteLine("-----------------------------");
RegisterTournament(1.5, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
Console.WriteLine("=============================");