generated from admin/template
lab-04
This commit is contained in:
@@ -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
|
||||
@@ -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<string> backpack = new List<string>();
|
||||
|
||||
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<string> backpack = new List<string>();
|
||||
|
||||
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}");
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>lab_04</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user