Обновить works/csharp/lab-02/Program.cs

This commit is contained in:
2026-09-06 11:54:59 +00:00
parent 1d28ded20b
commit 6960c2286b
+6 -5
View File
@@ -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)
{