diff --git a/works/lab-04/lab-04.sln b/works/lab-04/lab-04.sln new file mode 100644 index 0000000..14aacd5 --- /dev/null +++ b/works/lab-04/lab-04.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab-04", "lab-04\lab-04.csproj", "{3BC5BEAD-FCA4-4842-A7E9-06F8BF13E87E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3BC5BEAD-FCA4-4842-A7E9-06F8BF13E87E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BC5BEAD-FCA4-4842-A7E9-06F8BF13E87E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BC5BEAD-FCA4-4842-A7E9-06F8BF13E87E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BC5BEAD-FCA4-4842-A7E9-06F8BF13E87E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/works/lab-04/lab-04/Program.cs b/works/lab-04/lab-04/Program.cs new file mode 100644 index 0000000..3383a46 --- /dev/null +++ b/works/lab-04/lab-04/Program.cs @@ -0,0 +1,54 @@ +// ======================================================================== +string[] activeTeam = new string[3]; + +Console.WriteLine("Enter three pokemon names in your team:"); + +for (int i = 0; i < activeTeam.Length; i++) +{ + Console.Write($"Pokemon #{i + 1} - "); + activeTeam[i] = Console.ReadLine() ?? ""; +} + +Console.WriteLine($"First pokemon: {activeTeam[0]} \nSecond pokemon: {activeTeam[1]} \nThird pokemon: {activeTeam[2]}"); + +// ======================================================================== +BackpackCount(); + +void BackpackCount() +{ + List backpack = new List(); + + backpack.Add("heal"); + backpack.Add("pokeball"); + backpack.Add("antidote"); + + Console.WriteLine($"elements in backpack - {backpack.Count}"); + + backpack.Remove("pokeball"); + + Console.WriteLine($"elements in backpack after using pokeball - {backpack.Count}"); +} + +// ======================================================================== +BackpackListing(); + +void BackpackListing() +{ + List backpack = new List(); + + backpack.Add("heal"); + backpack.Add("pokeball"); + backpack.Add("antidote"); + + Console.WriteLine($"items in backpack - {backpack.Count}"); + + backpack.Remove("pokeball"); + + Console.WriteLine($"list of items in your backpack:"); + foreach (var item in backpack) + { + Console.WriteLine($"[item] -> {item}"); + } + + Console.WriteLine($"items in backpack after using pokeball - {backpack.Count}"); +} diff --git a/works/lab-04/lab-04/lab-04.csproj b/works/lab-04/lab-04/lab-04.csproj new file mode 100644 index 0000000..f4df610 --- /dev/null +++ b/works/lab-04/lab-04/lab-04.csproj @@ -0,0 +1,11 @@ + + + + Exe + net10.0 + lab_04 + enable + enable + + +