From 32ca0295c937d868a090c677144dc49d8c1b4e0f Mon Sep 17 00:00:00 2001 From: sebi Date: Mon, 27 Nov 2023 16:36:18 +0100 Subject: [PATCH] =?UTF-8?q?Dictionary=20=C3=9Cbungen=20erweitert=20&=20zur?= =?UTF-8?q?=20Program=20hinzugef=C3=BCgt=20Sorting=20angepasst=20Multithre?= =?UTF-8?q?ading=20angefangen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Program.cs | 18 ++++++++++++++++++ XX_Dictionary/Exercise_4.cs | 4 ++-- XX_Dictionary/Exercise_5.cs | 4 ++-- XX_Multithreading/Exercise_1.cs | 0 XX_Multithreading/Exercise_2.cs | 0 XX_Multithreading/Exercise_3.cs | 0 XX_Multithreading/Exercise_4.cs | 0 XX_Multithreading/Exercise_5.cs | 0 XX_Sorting/{Excercise_1.cs => Exercise_1.cs} | 0 9 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 XX_Multithreading/Exercise_1.cs create mode 100644 XX_Multithreading/Exercise_2.cs create mode 100644 XX_Multithreading/Exercise_3.cs create mode 100644 XX_Multithreading/Exercise_4.cs create mode 100644 XX_Multithreading/Exercise_5.cs rename XX_Sorting/{Excercise_1.cs => Exercise_1.cs} (100%) diff --git a/Program.cs b/Program.cs index 6b46b8e..4909cb1 100644 --- a/Program.cs +++ b/Program.cs @@ -448,6 +448,23 @@ namespace Exercises_C_Sharp } }; + + //************************ + //******Dictionary******** + //************************ + ExerciseGroup dictionaryElements = new ExerciseGroup() + { + Name = "Schulaufgaben", + ElementList = new List() + { + new ExerciseElement(){Name = "Aufgabe 1", Method = Exercises_C_Sharp.XX_Dictionary.Exercise_1.Start}, + new ExerciseElement(){Name = "Aufgabe 2", Method = Exercises_C_Sharp.XX_Dictionary.Exercise_2.Start}, + new ExerciseElement(){Name = "Aufgabe 3", Method = Exercises_C_Sharp.XX_Dictionary.Exercise_3.Start}, + new ExerciseElement(){Name = "Aufgabe 4", Method = Exercises_C_Sharp.XX_Dictionary.Exercise_4.Start}, + new ExerciseElement(){Name = "Aufgabe 5", Method = Exercises_C_Sharp.XX_Dictionary.Exercise_5.Start} + } + }; + //************************ //****Sortieren******* //************************ @@ -494,6 +511,7 @@ namespace Exercises_C_Sharp filesystemElements, mysqlElements, sortElements, + dictionaryElements, examElements }; diff --git a/XX_Dictionary/Exercise_4.cs b/XX_Dictionary/Exercise_4.cs index b0d6250..4c4ce36 100644 --- a/XX_Dictionary/Exercise_4.cs +++ b/XX_Dictionary/Exercise_4.cs @@ -6,10 +6,10 @@ namespace Exercises_C_Sharp.XX_Dictionary { class Exercise_4 { - //... + //Addieren Sie alle Value-Werte mit geraden Index auf und geben Sie das Ergebnis aus. public static void Start() { - Dictionary dic = new(); + Dictionary dic = new() {{1, 14.85}, {2, 58.52}, {3, 8.63}, {4, 6.49}, {5, 62.85}, {6, 2.22}, {7, 3.33}, {8, 9.99}}; //Code Start diff --git a/XX_Dictionary/Exercise_5.cs b/XX_Dictionary/Exercise_5.cs index 80484fd..a0c49ca 100644 --- a/XX_Dictionary/Exercise_5.cs +++ b/XX_Dictionary/Exercise_5.cs @@ -6,10 +6,10 @@ namespace Exercises_C_Sharp.XX_Dictionary { class Exercise_5 { - //... + //Der User soll hier ein Wort eingeben. Wenn es sich schon im Dictionary befindet, dann soll die Übersetzung ausgegeben werden. Wenn nicht, dass soll der User die Übersetzung eingeben und beide Elemente sollen in dem Dictionary gespeichert werden. Groß- und Kleinschreibung soll keine Rolle spielen. public static void Start() { - Dictionary dic = new(); + Dictionary dic = new(){{"black", "schwarz"}, {"exception", "Ausnahme"}, {"barrel", "Fass"}}; //Code Start diff --git a/XX_Multithreading/Exercise_1.cs b/XX_Multithreading/Exercise_1.cs new file mode 100644 index 0000000..e69de29 diff --git a/XX_Multithreading/Exercise_2.cs b/XX_Multithreading/Exercise_2.cs new file mode 100644 index 0000000..e69de29 diff --git a/XX_Multithreading/Exercise_3.cs b/XX_Multithreading/Exercise_3.cs new file mode 100644 index 0000000..e69de29 diff --git a/XX_Multithreading/Exercise_4.cs b/XX_Multithreading/Exercise_4.cs new file mode 100644 index 0000000..e69de29 diff --git a/XX_Multithreading/Exercise_5.cs b/XX_Multithreading/Exercise_5.cs new file mode 100644 index 0000000..e69de29 diff --git a/XX_Sorting/Excercise_1.cs b/XX_Sorting/Exercise_1.cs similarity index 100% rename from XX_Sorting/Excercise_1.cs rename to XX_Sorting/Exercise_1.cs