generated from admin/template
laba 2
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pokemon", "pokemon\pokemon.csproj", "{B798669A-D382-403D-B841-A6C259209663}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B798669A-D382-403D-B841-A6C259209663}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B798669A-D382-403D-B841-A6C259209663}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B798669A-D382-403D-B841-A6C259209663}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B798669A-D382-403D-B841-A6C259209663}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,34 @@
|
||||
//задание 1.1
|
||||
Console.WriteLine("===ПРОКАЧКА ПОКЕМОНА===");
|
||||
Console.Write("Введите базовое значение атаки покемона: ");
|
||||
int baseAttack = int.Parse(Console.ReadLine());
|
||||
|
||||
Console.Write("Введите количество полученных уровней: ");
|
||||
int level = int.Parse(Console.ReadLine());
|
||||
|
||||
int finalAttack = baseAttack +(level*5);
|
||||
Console.WriteLine($"Итоговая атака покемона : {finalAttack} \n");
|
||||
|
||||
//задание 1.2
|
||||
int trainerBalance = 1500;
|
||||
const int potionPrice =200;
|
||||
Console.WriteLine("===ИНВЕНТАРЬ===");
|
||||
Console.Write($"Ваш текущий баланс:{trainerBalance} монет \n");
|
||||
Console.WriteLine("Сколько зелий вы хотите преобрести?");
|
||||
int potionCost = int.Parse(Console.ReadLine());
|
||||
int totalCost = potionPrice * potionCost;
|
||||
int remainingBalance = trainerBalance - totalCost;
|
||||
|
||||
if (remainingBalance >= 0)
|
||||
{
|
||||
Console.WriteLine($"Покупка успешна! Вы купили {potionCost} зелий.");
|
||||
Console.WriteLine($"Остаток на балансе {remainingBalance} монет.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Недостоточно средств для покупки!");
|
||||
Console.WriteLine($"Вам не хватает {Math.Abs(remainingBalance)} монет");
|
||||
}
|
||||
//Блок 2
|
||||
//задание 2.1
|
||||
Console.WriteLine("===Проверка состояния покемона===");
|
||||
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user