diff --git a/works/lab-02/lesson2/global.json b/works/lab-02/lesson2/global.json new file mode 100644 index 0000000..93681ff --- /dev/null +++ b/works/lab-02/lesson2/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "9.0.0", + "rollForward": "latestMinor", + "allowPrerelease": false + } +} \ No newline at end of file diff --git a/works/lab-02/lesson2/lesson2.sln b/works/lab-02/lesson2/lesson2.sln new file mode 100644 index 0000000..83a8a53 --- /dev/null +++ b/works/lab-02/lesson2/lesson2.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lesson2", "lesson2\lesson2.csproj", "{478B1AA0-6B34-4B03-841D-E68F3D9D5EEB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {478B1AA0-6B34-4B03-841D-E68F3D9D5EEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {478B1AA0-6B34-4B03-841D-E68F3D9D5EEB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {478B1AA0-6B34-4B03-841D-E68F3D9D5EEB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {478B1AA0-6B34-4B03-841D-E68F3D9D5EEB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/works/lab-02/lesson2/lesson2/Program.cs b/works/lab-02/lesson2/lesson2/Program.cs new file mode 100644 index 0000000..a971d59 --- /dev/null +++ b/works/lab-02/lesson2/lesson2/Program.cs @@ -0,0 +1,34 @@ +// See https://aka.ms/new-console-template for more information + +Console.WriteLine("=== Прокачка покемона ==="); +Console.Write("Введите базовое значение атаки покемона: "); +int baseAttack = int.Parse(Console.ReadLine()); +Console.Write("Введите количество полученных уровней: "); +int acceptLevel = int.Parse(Console.ReadLine()); + +int endAttack = baseAttack + (acceptLevel * 5); + +Console.WriteLine($"Итоговое значение атаки: {endAttack}"); + + +int beginBalance = 1500; +int costPotion = 200; +Console.WriteLine($"Текущий баланс: {beginBalance}"); +Console.Write("Введите количество приобретаемых зелий: "); +int amountPotions = 0; +do +{ + amountPotions = int.Parse(Console.ReadLine()); + if (amountPotions * costPotion > beginBalance) + { + Console.Write("Стоимость превышает текущий баланс! Ведите другое значение: "); + amountPotions = int.Parse(Console.ReadLine()); + } +} +while (amountPotions * costPotion > beginBalance); + +int endCost = beginBalance - (amountPotions * costPotion); + + + +Console.WriteLine($"Успешная покупка! Баланс: {endCost}"); diff --git a/works/lab-02/lesson2/lesson2/lesson2.csproj b/works/lab-02/lesson2/lesson2/lesson2.csproj new file mode 100644 index 0000000..85b4959 --- /dev/null +++ b/works/lab-02/lesson2/lesson2/lesson2.csproj @@ -0,0 +1,10 @@ + + + + Exe + net9.0 + enable + enable + + +