From 27cac60e37ca18901dfa3785974a3c15ef83f464 Mon Sep 17 00:00:00 2001 From: Mamedka Date: Tue, 8 Sep 2026 09:11:13 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?works/lab-02=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works/lab-02/lab2.1.cs | 15 +++++++++++++++ works/lab-02/lab2.2.cs | 23 +++++++++++++++++++++++ works/lab-02/lab2.3.cs | 27 +++++++++++++++++++++++++++ works/lab-02/lab2.4.cs | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 works/lab-02/lab2.1.cs create mode 100644 works/lab-02/lab2.2.cs create mode 100644 works/lab-02/lab2.3.cs create mode 100644 works/lab-02/lab2.4.cs diff --git a/works/lab-02/lab2.1.cs b/works/lab-02/lab2.1.cs new file mode 100644 index 0000000..1cba78b --- /dev/null +++ b/works/lab-02/lab2.1.cs @@ -0,0 +1,15 @@ +using System; + +class Program { + static void Main() { + Console.OutputEncoding = System.Text.Encoding.UTF8; +Console.InputEncoding = System.Text.Encoding.UTF8; + Console.WriteLine("=== Прокачка покемона ==="); + Console.WriteLine("Введите базовую атаку покемона: "); + int baseDamage = int.Parse(Console.ReadLine()); + Console.WriteLine("Введите кол-во полученных уровней: "); + int reachedLevels = int.Parse(Console.ReadLine()); + int finalDamage = baseDamage * (reachedLevels * 5); + Console.WriteLine($"Ваш финальный урон: {finalDamage}"); + } +} diff --git a/works/lab-02/lab2.2.cs b/works/lab-02/lab2.2.cs new file mode 100644 index 0000000..cf3e1b9 --- /dev/null +++ b/works/lab-02/lab2.2.cs @@ -0,0 +1,23 @@ +using System; + +class Program { + static void Main() { + Console.OutputEncoding = System.Text.Encoding.UTF8; +Console.InputEncoding = System.Text.Encoding.UTF8; + int balance = 1500; + int potionSale = 200; + Console.WriteLine("Ваш баланс 1500 монет"); + Console.WriteLine("Зелье стоит 200 монет"); + Console.WriteLine("Сколько зелий вы хотите купить?"); + int potionBuy = int.Parse(Console.ReadLine()); + int ostatok = 1500 - potionBuy * 200 ; + if (ostatok < 0) + { + Console.WriteLine("У вас не хватает денег! Купите поменьше!"); + } + else + { + Console.WriteLine($"Вы купили {potionBuy} зелий, у вас осталось {ostatok} монет"); + } + } +} diff --git a/works/lab-02/lab2.3.cs b/works/lab-02/lab2.3.cs new file mode 100644 index 0000000..7449be5 --- /dev/null +++ b/works/lab-02/lab2.3.cs @@ -0,0 +1,27 @@ +using System; + +class Program { + static void Main() { + Console.OutputEncoding = System.Text.Encoding.UTF8; +Console.InputEncoding = System.Text.Encoding.UTF8; + Console.WriteLine("Вашего покемона атаковали!"); + Console.WriteLine("Введите сколько у него осталось здоровье! (максимум 50)"); + int currentHp = int.Parse(Console.ReadLine()); + if (currentHp <= 0) + { + Console.WriteLine("Покемон потерял сознание! Верните его в покебол."); + } + if (currentHp > 1 && currentHp < 21) + { +Console.WriteLine("Критическое состояние! Срочно используйте зелье!"); + } + if (currentHp > 20 && currentHp < 50) + { +Console.WriteLine("Покемон ранен, будьте осторожны."); + } + if (currentHp >= 50) + { +Console.WriteLine("Покемон полон сил и готов к бою!"); + } + } +} diff --git a/works/lab-02/lab2.4.cs b/works/lab-02/lab2.4.cs new file mode 100644 index 0000000..3f619a7 --- /dev/null +++ b/works/lab-02/lab2.4.cs @@ -0,0 +1,32 @@ +using System; + +class Program { + static void Main() { + Console.OutputEncoding = System.Text.Encoding.UTF8; +Console.InputEncoding = System.Text.Encoding.UTF8; + Console.WriteLine("БОЙ НАЧАЛСЯ, ДАЙТЕ ПОКЕМОНУ КОМАНДУ!"); + Console.WriteLine("1 — Атака"); + Console.WriteLine("2 — Инвентарь"); + Console.WriteLine("3 — Сменить покемона"); + Console.WriteLine("4 — Побег"); + int command = int.Parse(Console.ReadLine()); + switch(command) + { + case 1: + Console.WriteLine("Покемон наносит быстрый удар!"); + break; + case 2: + Console.WriteLine("Вы открыли сумку и применили Зелье Лечения."); + break; + case 3: + Console.WriteLine("Вы отозвали покемона и выпустили нового!"); + break; + case 4: + Console.WriteLine("Вы успешно сбежали из боя!"); + break; + default: + Console.WriteLine("Неизвестная команда! Вы пропустили ход."); + break; + } + } +}