diff --git a/Exercises/E27_Jagged_Arrays/Exercise_1.cs b/Exercises/E27_Jagged_Arrays/Exercise_1.cs index 3d0b5f6..05609d3 100644 --- a/Exercises/E27_Jagged_Arrays/Exercise_1.cs +++ b/Exercises/E27_Jagged_Arrays/Exercise_1.cs @@ -15,6 +15,8 @@ namespace Exercises_C_Sharp.E27_Jagged_Arrays //Code START + int[][] jaggedArray = [array1, array2, array3]; + //Code ENDE } } diff --git a/Exercises/E27_Jagged_Arrays/Exercise_2.cs b/Exercises/E27_Jagged_Arrays/Exercise_2.cs index bf2c550..bf24b90 100644 --- a/Exercises/E27_Jagged_Arrays/Exercise_2.cs +++ b/Exercises/E27_Jagged_Arrays/Exercise_2.cs @@ -18,6 +18,18 @@ namespace Exercises_C_Sharp.E27_Jagged_Arrays //Code START + foreach (var jarray in JaggedArray) + { + for (int i = 0; i < jarray.Length; i++) + { + if (i == 0 || jarray[i] == ".") + Console.Write(jarray[i]); + else + Console.Write(" " + jarray[i]); + } + Console.WriteLine(); + } + //Code ENDE } } diff --git a/Exercises/E27_Jagged_Arrays/Exercise_3.cs b/Exercises/E27_Jagged_Arrays/Exercise_3.cs index e2950c6..74481cf 100644 --- a/Exercises/E27_Jagged_Arrays/Exercise_3.cs +++ b/Exercises/E27_Jagged_Arrays/Exercise_3.cs @@ -13,6 +13,15 @@ namespace Exercises_C_Sharp.E27_Jagged_Arrays //Code START + for (int i = 0; i < 3; i++) + { + //Usereingabe + string input = Console.ReadLine() ?? ""; + + //Unterteilung + Zuweisung + JaggedArray[i] = input.Split(' '); + } + //Code ENDE } } diff --git a/Exercises/E27_Jagged_Arrays/Exercise_4.cs b/Exercises/E27_Jagged_Arrays/Exercise_4.cs index 32727c8..75780e4 100644 --- a/Exercises/E27_Jagged_Arrays/Exercise_4.cs +++ b/Exercises/E27_Jagged_Arrays/Exercise_4.cs @@ -19,6 +19,29 @@ namespace Exercises_C_Sharp.E27_Jagged_Arrays //Sorgen Sie dafür, dass im Jagged Array oben alle ungeraden Zahlen herausgelöscht werden. Geben Sie dann das Array zur kontrolle aus. //Code START + int[][] tempArr = new int[JaggedArray.Length][]; + + for (int i = 0; i < JaggedArray.Length; i++) + { + List tempList = []; + + foreach (var element in JaggedArray[i]) + if (element % 2 == 0) + tempList.Add(element); + + tempArr[i] = tempList.ToArray(); + } + JaggedArray = tempArr; + + foreach (var arr in JaggedArray) + { + foreach (var element in arr) + { + Console.Write(element + " "); + } + Console.WriteLine(); + } + //Code ENDE } diff --git a/lastPoint b/lastPoint index e44d3bf..2b1637f 100644 --- a/lastPoint +++ b/lastPoint @@ -1,2 +1,2 @@ 3 -25 +26