generated from admin/template
Обновить works/csharp/lab-02/Program.cs
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
namespace Lab02
|
namespace Lab02
|
||||||
{
|
{
|
||||||
internal class Program
|
internal class Program
|
||||||
@@ -9,10 +10,10 @@ namespace Lab02
|
|||||||
// Задание 1.1: Расчёт характеристик покемона
|
// Задание 1.1: Расчёт характеристик покемона
|
||||||
Console.WriteLine("=== Прокачка покемона ===");
|
Console.WriteLine("=== Прокачка покемона ===");
|
||||||
Console.Write("Введите базовое значение атаки: ");
|
Console.Write("Введите базовое значение атаки: ");
|
||||||
int baseAttack = int.Parse(Console.ReadLine());
|
int baseAttack = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
Console.Write("Введите количество полученных уровней: ");
|
Console.Write("Введите количество полученных уровней: ");
|
||||||
int levels = int.Parse(Console.ReadLine());
|
int levels = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
int totalAttack = baseAttack + (levels * 5);
|
int totalAttack = baseAttack + (levels * 5);
|
||||||
Console.WriteLine($"Итоговая атака: {totalAttack}\n");
|
Console.WriteLine($"Итоговая атака: {totalAttack}\n");
|
||||||
@@ -23,7 +24,7 @@ namespace Lab02
|
|||||||
|
|
||||||
Console.WriteLine($"Текущий баланс: {balance} монет.");
|
Console.WriteLine($"Текущий баланс: {balance} монет.");
|
||||||
Console.Write("Сколько зелий лечения вы хотите купить? ");
|
Console.Write("Сколько зелий лечения вы хотите купить? ");
|
||||||
int potionCount = int.Parse(Console.ReadLine());
|
int potionCount = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
int totalPrice = potionCount * potionPrice;
|
int totalPrice = potionCount * potionPrice;
|
||||||
balance -= totalPrice;
|
balance -= totalPrice;
|
||||||
@@ -34,7 +35,7 @@ namespace Lab02
|
|||||||
|
|
||||||
// Задание 2.1: Проверка состояния покемона в бою
|
// Задание 2.1: Проверка состояния покемона в бою
|
||||||
Console.Write("Введите текущее количество HP покемона: ");
|
Console.Write("Введите текущее количество HP покемона: ");
|
||||||
int currentHp = int.Parse(Console.ReadLine());
|
int currentHp = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
if (currentHp <= 0)
|
if (currentHp <= 0)
|
||||||
{
|
{
|
||||||
@@ -63,7 +64,7 @@ namespace Lab02
|
|||||||
Console.WriteLine("4 — Побег");
|
Console.WriteLine("4 — Побег");
|
||||||
Console.Write("Выберите действие (1-4): ");
|
Console.Write("Выберите действие (1-4): ");
|
||||||
|
|
||||||
int action = int.Parse(Console.ReadLine());
|
int action = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user