diff --git a/works/CSharp/task/global.json b/works/CSharp/task/global.json new file mode 100644 index 0000000..90e5a42 --- /dev/null +++ b/works/CSharp/task/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "10.0.0", + "rollForward": "latestMinor", + "allowPrerelease": false + } +} \ No newline at end of file diff --git a/works/CSharp/task/task.sln b/works/CSharp/task/task.sln new file mode 100644 index 0000000..9a53230 --- /dev/null +++ b/works/CSharp/task/task.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "task", "task\task.csproj", "{3070CC6A-0E11-41A9-AE22-0CAD4D1286E8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3070CC6A-0E11-41A9-AE22-0CAD4D1286E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3070CC6A-0E11-41A9-AE22-0CAD4D1286E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3070CC6A-0E11-41A9-AE22-0CAD4D1286E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3070CC6A-0E11-41A9-AE22-0CAD4D1286E8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/works/CSharp/task/task/Program.cs b/works/CSharp/task/task/Program.cs new file mode 100644 index 0000000..4a58d5f --- /dev/null +++ b/works/CSharp/task/task/Program.cs @@ -0,0 +1,151 @@ +using System; +namespace task +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("задача 1"); + string name = "Pikachu" ; + string type = "electric"; + int level = 25; + int hp = 120; + double attack = 12.5 ; + bool isShiny = false ; + Console.WriteLine($"{name} ({type}), lvl {level}, HP {hp}, Atk {attack}, shiny: {isShiny}"); + hp += 30; + level += 1; + Console.WriteLine($"{name} ({type}), lvl {level}, HP {hp}, Atk {attack}, shiny: {isShiny}"); + + Console.WriteLine("задача 2"); + string attackerType = "fire"; + if (attackerType == "fire") + { + Console.WriteLine("Огонь силён против травы"); + } + else if (attackerType == "water" ) + { + Console.WriteLine("Вода сильна против огня"); + } + else if (attackerType =="grass" ) + { + Console.WriteLine("Трава сильна против воды"); + } + else if (attackerType == "electric" ) + { + Console.WriteLine("Электричество сильно против воды"); + } + else Console.WriteLine("Тип не изучен"); + + Console.WriteLine("задача 3"); + string type1 = "water"; + Console.Write("Урон по water от grass: x"); + switch (type1) + { + case "grass": + Console.WriteLine(2.0); + break; + case "electric": + Console.WriteLine(0.5); + break; + case "fire": + Console.WriteLine(0.5); + break; + case "water": + Console.WriteLine(1.0); + break; + default: + Console.WriteLine(1.0); + break; + + + } + + + // string type2 = number switch + // { + // "grass" => "2.0", + // "electric" => "2.0", + // "fire" => "0.5", + // "water" => "0.5", + // _ => "1.0" + // }; + // Console.WriteLine($"Урон по water от grass: x{type1}"); + + + Console.WriteLine("задача 4"); + int hp1 = 100; + int round = 0; + + while (hp1 > 0) + { + round++; + hp1 -= 17; + Console.WriteLine($"Покемон продержался {round} раундов, HP = {hp1}"); + } + + for (int i = 1; i <= 10; i++) + { + Console.WriteLine(i); + } + + for (int i = 1; i <= 10; i++) + { + if (i == 3) continue; + if (i == 9) break; + Console.WriteLine(i); + } + + + Console.WriteLine("задача 5"); + + List team = new List(); + team.Add("Pikachu"); + team.Add("Bulbasaur"); + team.Add("Charmander"); + team.Add("Zubat"); + + Console.WriteLine(team.Count); + Console.WriteLine(team[1]); + // foreach (string pokemon in team) + // { + // Console.WriteLine($"[Предмет] -> {item}"); + // } + + + Console.WriteLine("задача 6"); + var pokedex = new Dictionary(); + pokedex["Pikachu"] = 0; + pokedex["Bulbasaur"] = 1; + pokedex["Charmander"] = 2; + pokedex["Zubat"] = 3; + +// // Проверка наличия +// if (pokedex.ContainsKey("Pikachu")) +// { +// Console.WriteLine(pokedex["Pikachu"]); // 25 +// } +// +// // Безопасное получение +// if (pokedex.TryGetValue("Missingno", out int num)) +// { +// Console.WriteLine(num); +// } +// else +// { +// Console.WriteLine("Нет в покедексе"); +// } +// +// // Перебор +// foreach (var pair in pokedex) +// { +// Console.WriteLine($"{pair.Key} -> {pair.Value}"); +// } +// +// + + + + } + } +} \ No newline at end of file diff --git a/works/CSharp/task/task/Properties/launchSettings.json b/works/CSharp/task/task/Properties/launchSettings.json new file mode 100644 index 0000000..699343f --- /dev/null +++ b/works/CSharp/task/task/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5043", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7131;http://localhost:5043", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/works/CSharp/task/task/appsettings.Development.json b/works/CSharp/task/task/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/works/CSharp/task/task/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/works/CSharp/task/task/appsettings.json b/works/CSharp/task/task/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/works/CSharp/task/task/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/works/CSharp/task/task/task.csproj b/works/CSharp/task/task/task.csproj new file mode 100644 index 0000000..43e9f4e --- /dev/null +++ b/works/CSharp/task/task/task.csproj @@ -0,0 +1,13 @@ + + + + net10.0 + enable + enable + + + + + + + diff --git a/works/CSharp/task/task/task.http b/works/CSharp/task/task/task.http new file mode 100644 index 0000000..b048688 --- /dev/null +++ b/works/CSharp/task/task/task.http @@ -0,0 +1,6 @@ +@task_HostAddress = http://localhost:5043 + +GET {{task_HostAddress}}/weatherforecast/ +Accept: application/json + +###