From 6960c2286be9b15cdb429682acd371de20695103 Mon Sep 17 00:00:00 2001 From: ArtemSimonov Date: Sun, 6 Sep 2026 11:54:59 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20works/csharp/lab-02/Program.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works/csharp/lab-02/Program.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/works/csharp/lab-02/Program.cs b/works/csharp/lab-02/Program.cs index d5ba6df..db441cf 100644 --- a/works/csharp/lab-02/Program.cs +++ b/works/csharp/lab-02/Program.cs @@ -1,3 +1,4 @@ +using System; namespace Lab02 { internal class Program @@ -9,10 +10,10 @@ namespace Lab02 // Задание 1.1: Расчёт характеристик покемона Console.WriteLine("=== Прокачка покемона ==="); Console.Write("Введите базовое значение атаки: "); - int baseAttack = int.Parse(Console.ReadLine()); + int baseAttack = Convert.ToInt32(Console.ReadLine()); Console.Write("Введите количество полученных уровней: "); - int levels = int.Parse(Console.ReadLine()); + int levels = Convert.ToInt32(Console.ReadLine()); int totalAttack = baseAttack + (levels * 5); Console.WriteLine($"Итоговая атака: {totalAttack}\n"); @@ -23,7 +24,7 @@ namespace Lab02 Console.WriteLine($"Текущий баланс: {balance} монет."); Console.Write("Сколько зелий лечения вы хотите купить? "); - int potionCount = int.Parse(Console.ReadLine()); + int potionCount = Convert.ToInt32(Console.ReadLine()); int totalPrice = potionCount * potionPrice; balance -= totalPrice; @@ -34,7 +35,7 @@ namespace Lab02 // Задание 2.1: Проверка состояния покемона в бою Console.Write("Введите текущее количество HP покемона: "); - int currentHp = int.Parse(Console.ReadLine()); + int currentHp = Convert.ToInt32(Console.ReadLine()); if (currentHp <= 0) { @@ -63,7 +64,7 @@ namespace Lab02 Console.WriteLine("4 — Побег"); Console.Write("Выберите действие (1-4): "); - int action = int.Parse(Console.ReadLine()); + int action = Convert.ToInt32(Console.ReadLine()); switch (action) {