Initial commit

This commit is contained in:
Mark J Price 2022-02-18 12:13:25 +00:00
parent ca7684985d
commit 49bdd4dda1
60 changed files with 1527 additions and 30 deletions

View file

@ -1,10 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Using Include="System.Console" Static="true" />
</ItemGroup>
</Project>

View file

@ -15,7 +15,7 @@ string[] names2 = new[] { "Kate", "Jack", "Rebecca", "Tom" };
for (int i = 0; i < names2.Length; i++)
{
// output the item at index position i
Console.WriteLine(names2[i]);
WriteLine(names2[i]);
}
string[,] grid1 = new[,] // two dimensions
@ -25,16 +25,16 @@ string[,] grid1 = new[,] // two dimensions
{ "Aardvark", "Bear", "Cat", "Dog" }
};
Console.WriteLine($"Lower bound of the first dimension is: {grid1.GetLowerBound(0)}");
Console.WriteLine($"Upper bound of the first dimension is: {grid1.GetUpperBound(0)}");
Console.WriteLine($"Lower bound of the second dimension is: {grid1.GetLowerBound(1)}");
Console.WriteLine($"Upper bound of the second dimension is: {grid1.GetUpperBound(1)}");
WriteLine($"Lower bound of the first dimension is: {grid1.GetLowerBound(0)}");
WriteLine($"Upper bound of the first dimension is: {grid1.GetUpperBound(0)}");
WriteLine($"Lower bound of the second dimension is: {grid1.GetLowerBound(1)}");
WriteLine($"Upper bound of the second dimension is: {grid1.GetUpperBound(1)}");
for (int row = 0; row <= grid1.GetUpperBound(0); row++)
{
for (int col = 0; col <= grid1.GetUpperBound(1); col++)
{
Console.WriteLine($"Row {row}, Column {col}: {grid1[row, col]}");
WriteLine($"Row {row}, Column {col}: {grid1[row, col]}");
}
}
@ -51,12 +51,12 @@ string[][] jagged = new[] // array of string arrays
new[] { "Aardvark", "Bear" }
};
Console.WriteLine("Upper bound of array of arrays is: {0}",
WriteLine("Upper bound of array of arrays is: {0}",
jagged.GetUpperBound(0));
for (int array = 0; array <= jagged.GetUpperBound(0); array++)
{
Console.WriteLine("Upper bound of array {0} is: {1}",
WriteLine("Upper bound of array {0} is: {1}",
arg0: array,
arg1: jagged[array].GetUpperBound(0));
}
@ -65,6 +65,6 @@ for (int row = 0; row <= jagged.GetUpperBound(0); row++)
{
for (int col = 0; col <= jagged[row].GetUpperBound(0); col++)
{
Console.WriteLine($"Row {row}, Column {col}: {jagged[row][col]}");
WriteLine($"Row {row}, Column {col}: {jagged[row][col]}");
}
}