Обновленние-добавление

This commit is contained in:
ArhaNge1
2026-10-21 15:39:13 +03:00
parent efb41a5d8a
commit ebd04219c5
34 changed files with 35543 additions and 36 deletions
+16
View File
@@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lol", "lol\lol.csproj", "{8A527AAD-A846-404D-8FD5-3AD6BAFF66A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8A527AAD-A846-404D-8FD5-3AD6BAFF66A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A527AAD-A846-404D-8FD5-3AD6BAFF66A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A527AAD-A846-404D-8FD5-3AD6BAFF66A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A527AAD-A846-404D-8FD5-3AD6BAFF66A9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
+62
View File
@@ -0,0 +1,62 @@
using System;
namespace ConsoleApp1
{
public class Pokemon: Pokemons
{
protected static string name;
protected static int level;
protected int hp;
public string Name
{
get => name;
set => name = string.IsNullOrWhiteSpace(value) ? "Я хуй знает что за покемон!" : value;
}
public int Level
{
get => level;
set => level = value < 1 ? 1 : value;
}
public int Hp
{
get => Hp;
set => hp = value < 1 ? 1 : value;
}
public Pokemon(string name, int level, int hp)
{
Name = name;
Level = level;
Hp = hp;
}
public virtual void Attaka()
{
Console.WriteLine($"{Name},(Ур. {Level}:)");
}
}
public class Pokemons
{
public virtual void Attack()
{
Console.WriteLine($"{Name} атакует как-то непонятно.");
}
}
public class Pikachu : Pokemons
{
public override void Attack()
{
Console.WriteLine($"{Name} бьёт током! Пика-пика!");
}
}
public class Squirtle : Pokemons
{
public override void Attack()
{
Console.WriteLine($"{Name} стреляет водой! Сквирт-сквирт!");
}
}
}
+10
View File
@@ -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>
+18 -36
View File
@@ -1,41 +1,23 @@
int pokemonHP = 20;
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
Console.WriteLine($"Здоровье до лечения: {pokemonHP} HP.");
HealPokemon(ref pokemonHP);
using System;
Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP.");
static void HealPokemon(ref int hp)
namespace ConsoleApp1
{
hp += 80;
Console.WriteLine("[Покецентр] Покемон полностью здоров! Восстановлено 80 HP.");
}
Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
Console.WriteLine("Вы зашли в высокую траву...");
SearchBushes(out string foundPokemon, out int pokemonLevel);
Console.WriteLine($"Шорох! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonLevel})!");
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
{
Random random = new Random();
foundPokemon = "Пикачу";
pokemonLevel = random.Next(1, 16);
}
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
RegisterTournament(1.5, "Бульбазавр", "Чармандер");
RegisterTournament(1.5, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
static void RegisterTournament(in double difficulty, params string[] participants)
public static void Main(string[] args)
{
Console.WriteLine("-----------------------------");
Console.WriteLine($"Коэффициент стадиона: {difficulty} ");
Console.WriteLine("Список участников: ");
foreach (string pokemon in participants)
{
Console.WriteLine($"* {pokemon} ");
}
}
Console.WriteLine("=============================");
class Pokemon
{
protected string Name;
protected int Level;
protected int hp;
}
public string Name
{
}
public int Level
public int hp;
}
+16
View File
@@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab-06", "lab-06\lab-06.csproj", "{E72FE545-8B00-4EB4-A6B4-9C5B1940EB7F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E72FE545-8B00-4EB4-A6B4-9C5B1940EB7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E72FE545-8B00-4EB4-A6B4-9C5B1940EB7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E72FE545-8B00-4EB4-A6B4-9C5B1940EB7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E72FE545-8B00-4EB4-A6B4-9C5B1940EB7F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
@@ -0,0 +1,61 @@
class Program
{
static void Main(string[] args)
{
// Выводим главный заголовок
Console.WriteLine("=== ПОКЕДЕКС ===");
// Создаем двух покемонов через new
Pokemon pokemon1 = new Pokemon("Пикачу", 5, 100);
pokemon1.ShowInfo(1);
Pokemon pokemon2 = new Pokemon("Сквиртл", 7, 90);
pokemon2.ShowInfo(2);
}
}
class Pokemon
{
private string name;
private int level;
private int hp;
public string Name
{
get { return name; }
set { name = value; }
}
public int Level
{
get { return level; }
set
{
if (value < 1) level = 1;
else if (value > 100) level = 100;
else level = value;
}
}
public int HP
{
get { return hp; }
set
{
if (value < 0) hp = 0;
else if (value > 100) hp = 100;
else hp = value;
}
}
public Pokemon(string name, int level, int hp)
{
Name = name;
Level = level;
HP = hp; // Добавили инициализацию HP
}
public void ShowInfo(int id)
{
Console.WriteLine($"{id}. Имя: {Name}, Уровень: {Level}, HP: {HP}");
}
}
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>lab_06</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>