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) {