private static void CaveOfProgrammingExercise5() { Console.WriteLine($"I have a two dimensional string array that looks like this: {_2dStringArray}\n"); Consoleum.WriteLineReadKey("Press any key and I will display the value of the third element of the second inner array...\n"); Console.WriteLine($"This is the value of the third element from the second inner array: {_2dArray[1, 2]}"); ReadKeyAndClear(); }
private static void CaveOfProgrammingExercise7() { Consoleum.WriteLineReadKey("For this exercise I have created a class called Car.\n\nIt has one method called Start.\n\nPress any key to create a new Car object and start the car...\n"); Car car = new Car(); car.Start(); Consoleum.WriteLineReadKey("\nPress any key to continue..."); Console.Clear(); }
private static void CaveOfProgrammingExercise6() { Console.WriteLine($"I have a two dimensional string array that looks like this: {_2dStringArray}\n"); Consoleum.WriteLineReadKey("Press any key and I will display this array in a table format...\n"); int longestStringLengthIn2dArray = _2dArray.GetLongestStringLength(); for (int i = 0; i < _2dArray.GetLength(0); i++) { for (int j = 0; j < _2dArray.GetLength(1); j++) { Console.Write($"{_2dArray[i, j].PadRight(longestStringLengthIn2dArray + 2, ' ')}"); } Console.WriteLine(); } ReadKeyAndClear(); }
private static void CaveOfProgrammingExercise4() { Consoleum.WriteLineReadKey($"I have an array that looks like this: {arrString}\n\nPress any key and I will display these values, each adjusted to the second decimal place, using a foreach loop...\n"); foreach (float f in arr) { Console.Write(f.ToString("0.00")); if (f != arr[arr.Length - 1]) { Console.Write(", "); } else { Console.WriteLine(); } } ReadKeyAndClear(); }
private static void CaveOfProgrammingExercise3() { Consoleum.WriteLineReadKey($"I have an array that looks like this: {arrString}\n\nPress any key and I will pull out only the second value in the array..."); Console.WriteLine($"\nThis is the second value in the array: {arr[1]}"); ReadKeyAndClear(); }