generated from admin/template
Загрузить файлы в «works/lab-05»
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
|
||||
namespace PokemonTournamentApp
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||
Console.InputEncoding = System.Text.Encoding.UTF8;
|
||||
|
||||
|
||||
|
||||
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 tournamentDifficulty = 1.5;
|
||||
|
||||
|
||||
RegisterTournament(in tournamentDifficulty, "Булбазавр", "Чармандер");
|
||||
Console.WriteLine("-----------------------------");
|
||||
|
||||
|
||||
RegisterTournament(in tournamentDifficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
|
||||
Console.WriteLine("=============================");
|
||||
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
// Демонстрация работы in:
|
||||
// difficulty = 2.0; // ОШИБКА КОМПИЛЯЦИИ! Менять in-параметры нельзя (только для чтения).
|
||||
|
||||
Console.WriteLine($"Коэффициент стадиона: {difficulty:F1}");
|
||||
Console.WriteLine("Список участников:");
|
||||
|
||||
|
||||
foreach (string pokemon in participants)
|
||||
{
|
||||
Console.WriteLine($" * {pokemon}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user