начал lesson6

This commit is contained in:
328p
2026-10-07 14:18:00 +03:00
parent 67347927f3
commit 7b607f208e
3 changed files with 82 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lesson6", "lesson6\lesson6.csproj", "{4FEDC623-0924-41BC-98BE-C2A83D856398}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4FEDC623-0924-41BC-98BE-C2A83D856398}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FEDC623-0924-41BC-98BE-C2A83D856398}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FEDC623-0924-41BC-98BE-C2A83D856398}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FEDC623-0924-41BC-98BE-C2A83D856398}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
+56
View File
@@ -0,0 +1,56 @@
class Pokemon
{
private string name;
private int level;
private int hp;
public string Name
{
get { return name;}
set {}
}
public int Level
{
get { return level;}
set {}
}
public int HP
{
get { return hp;}
set {}
}
public Pokemon(string name, int level, int hp)
{
Name = name;
Level = level;
HP = hp;
}
public void ShowInfo()
{
Console.Write($"Имя: {Name}, Уровень: {Level}, HP: {HP}");
}
static void Main()
{
var Picachu = new Pokemon("Пикачу", 5, 100);
var Scvirl = new Pokemon("Сквиртл", 7, 90);
Console.WriteLine("=== ПОКЕДЕКС ===");
Console.Write("1. ");
Picachu.ShowInfo();
Console.Write("2. ");
Scvirl.ShowInfo();
}
}
@@ -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>