generated from admin/template
Добавить works charp/labs 5
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
задание 1
|
||||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void HealPokemon(ref int hp)
|
||||
{
|
||||
hp += 80;
|
||||
|
||||
if (hp > 100)
|
||||
{
|
||||
hp = 100;
|
||||
}
|
||||
|
||||
Console.WriteLine("[Покецентр] Покемон прошел лечение!");
|
||||
}
|
||||
|
||||
static void Main()
|
||||
{
|
||||
int pokemonHP = 20;
|
||||
|
||||
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
|
||||
|
||||
Console.WriteLine("Здоровье до лечения: " + pokemonHP + " HP.");
|
||||
|
||||
HealPokemon(ref pokemonHP);
|
||||
|
||||
Console.WriteLine("Здоровье после лечения: " + pokemonHP + " HP.");
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
задание 2
|
||||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
|
||||
{
|
||||
Random random = new Random();
|
||||
|
||||
foundPokemon = "Пикачу";
|
||||
pokemonLevel = random.Next(1, 16);
|
||||
}
|
||||
|
||||
static void Main()
|
||||
{
|
||||
string pokemon;
|
||||
int level;
|
||||
|
||||
Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
|
||||
Console.WriteLine("Вы зашли в высокую траву...");
|
||||
|
||||
SearchBushes(out pokemon, out level);
|
||||
|
||||
Console.WriteLine("Шорох! Из кустов появляется дикий " + pokemon + "!");
|
||||
Console.WriteLine("Уровень покемона: " + level);
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
задание 3
|
||||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void RegisterTournament(in double difficulty, params string[] participants)
|
||||
{
|
||||
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
|
||||
Console.WriteLine("Коэффициент стадиона: " + difficulty);
|
||||
Console.WriteLine("Список участников:");
|
||||
|
||||
for (int i = 0; i < participants.Length; i++)
|
||||
{
|
||||
Console.WriteLine(" * " + participants[i]);
|
||||
}
|
||||
|
||||
Console.WriteLine("==============================");
|
||||
}
|
||||
|
||||
static void Main()
|
||||
{
|
||||
double difficulty = 1.5;
|
||||
|
||||
RegisterTournament(in difficulty, "Бульбазавр", "Чармандер");
|
||||
|
||||
RegisterTournament(in difficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user