Files
csharp/works/lab-05/ConsoleApp1/ConsoleApp1/Program.cs
T
2026-10-07 14:18:44 +03:00

60 lines
2.4 KiB
C#

using System;
namespace LabWork5
{
class Program
{
static void Main(string[] args)
{
// ЗАДАНИЕ 1
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
int pokemonHP = 20;
Console.WriteLine($"Здоровье до лечения: {pokemonHP} HP.");
HealPokemon(ref pokemonHP);
Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP.");
Console.WriteLine();
// ЗАДАНИЕ 2
Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
Console.WriteLine("Вы зашли в высокую траву...");
SearchBushes(out string foundPokemon, out int pokemonLevel);
Console.WriteLine($"Шорох! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonLevel})!");
Console.WriteLine();
// ЗАДАНИЕ 3
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
double difficulty = 1.5;
RegisterTournament(in difficulty, "Булбазавр", "Чармандер");
RegisterTournament(in difficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
Console.WriteLine("=============================");
}
// Задание 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)
{
Console.WriteLine($"Коэффициент стадиона: {difficulty}");
Console.WriteLine("Список участников:");
foreach (string p in participants)
{
Console.WriteLine($" * {p}");
}
Console.WriteLine("-----------------------------");
}
}
}