Добавить works с#/lab 5

This commit is contained in:
2026-11-26 17:48:23 +00:00
parent 2ce8668e9a
commit ed86c8c391
+50
View File
@@ -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("=============================");
}
}