- Anpassungen der Übungsnummern
- Leichtes Bugfixing - Codeverschönerung [Noch nicht fertig!]
This commit is contained in:
20
E22_Dictionary/Exercise_1.cs
Normal file
20
E22_Dictionary/Exercise_1.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace Exercises_C_Sharp.E22_Dictionary
|
||||
{
|
||||
class Exercise_1
|
||||
{
|
||||
//Erstellen Sie ein Dictionary, das zu den Datentypen passt.
|
||||
public static void Start()
|
||||
{
|
||||
//Code Start
|
||||
dynamic dic = -1;
|
||||
//Code ENDE
|
||||
dic.Add("Hallo", 12.54);
|
||||
dic.Add("Hi", 7.33);
|
||||
dic.Add("Hey", 0.56);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
E22_Dictionary/Exercise_2.cs
Normal file
20
E22_Dictionary/Exercise_2.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace Exercises_C_Sharp.E22_Dictionary
|
||||
{
|
||||
class Exercise_2
|
||||
{
|
||||
//Geben Sie alle Value-Werte hintereinander mit Leerzeichen getrennt auf der Konsole aus.
|
||||
public static void Start()
|
||||
{
|
||||
Dictionary<int, string> dic = new() { {12, "Dies"}, {4, "ist"}, {22, "ein"}, {94, "tolles"}, {26, "Ding!"} };
|
||||
|
||||
//Code Start
|
||||
|
||||
//Code ENDE
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
25
E22_Dictionary/Exercise_3.cs
Normal file
25
E22_Dictionary/Exercise_3.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace Exercises_C_Sharp.E22_Dictionary
|
||||
{
|
||||
class Exercise_3
|
||||
{
|
||||
//Sorgen Sie dafür, dass auf der Konsole "Dies ist mein Programm" ausgegeben wird.
|
||||
public static void Start()
|
||||
{
|
||||
Dictionary<string, string> dic = new();
|
||||
|
||||
//Code Start
|
||||
|
||||
//Code ENDE
|
||||
|
||||
Console.Write(dic["dieses"]);
|
||||
Console.Write(dic["ist"]);
|
||||
Console.Write(dic["Programm"]);
|
||||
Console.Write(dic["es"]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
21
E22_Dictionary/Exercise_4.cs
Normal file
21
E22_Dictionary/Exercise_4.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace Exercises_C_Sharp.E22_Dictionary
|
||||
{
|
||||
class Exercise_4
|
||||
{
|
||||
//Addieren Sie alle Value-Werte mit geraden Index auf und geben Sie das Ergebnis aus.
|
||||
public static void Start()
|
||||
{
|
||||
Dictionary<int, double> 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
|
||||
|
||||
//Code ENDE
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
21
E22_Dictionary/Exercise_5.cs
Normal file
21
E22_Dictionary/Exercise_5.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace Exercises_C_Sharp.E22_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<string, string> dic = new(){{"black", "schwarz"}, {"exception", "Ausnahme"}, {"barrel", "Fass"}};
|
||||
|
||||
//Code Start
|
||||
|
||||
//Code ENDE
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user