Reorder
This commit is contained in:
19
Exercises/E03_Strings/Exercise_1.cs
Normal file
19
Exercises/E03_Strings/Exercise_1.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_1
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Sorgen Sie dafür, dass "Hallo, wie geht's?" unten auf der Konsole ausgegeben wird.
|
||||
//Code START
|
||||
dynamic s = -1;
|
||||
//Code ENDE
|
||||
|
||||
Console.WriteLine(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
Exercises/E03_Strings/Exercise_10.cs
Normal file
28
Exercises/E03_Strings/Exercise_10.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_10
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Sorgen Sie dafür, dass auf der Konsole
|
||||
//"Das Erste kommt zuerst...
|
||||
//...und das Zweite kommt zuletzt."
|
||||
//ausgegeben wird
|
||||
|
||||
|
||||
//Code START
|
||||
string s1 = "";
|
||||
string s2 = "";
|
||||
string s3 = "";
|
||||
string s4 = "";
|
||||
//Code ENDE
|
||||
string s = string.Format("{0} Erste kommt zu{1}{2}das Zweite{3}zuletzt.", s2, s1, s4, s3);
|
||||
|
||||
Console.WriteLine(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Exercises/E03_Strings/Exercise_11.cs
Normal file
22
Exercises/E03_Strings/Exercise_11.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_11
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Sorgen Sie dafür, dass auf der Konsole ein richtiger Satz ausgegeben wird.
|
||||
string s1 = "Piratenschiff";
|
||||
|
||||
//Code START
|
||||
string s2 = "";
|
||||
int i1 = -1;
|
||||
//Code ENDE
|
||||
|
||||
Console.WriteLine($"Das Wort {s1} hat genau so viele Zeichen wie {s2}, nämlich {i1}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Exercises/E03_Strings/Exercise_12.cs
Normal file
29
Exercises/E03_Strings/Exercise_12.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_12
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Sorgen Sie dafür, dass nach der Eingabe ausgegeben wird, ob der eingegebene String ein A bzw. a besitzt, oder nicht.
|
||||
string s = Console.ReadLine() ?? "Irgendwas";
|
||||
bool b = false;
|
||||
|
||||
//CODE START
|
||||
|
||||
//CODE ENDE
|
||||
|
||||
if(b)
|
||||
{
|
||||
Console.WriteLine("Das Wort enthält den Buchstaben A.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Das Wort enthält nicht den Buchstaben A.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
Exercises/E03_Strings/Exercise_2.cs
Normal file
27
Exercises/E03_Strings/Exercise_2.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_2
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Fügen Sie die Strings so zusammen, dass der Satz "Wie gut es ist, oder?" ausgegeben wird. Nutzen Sie wo es geht die folgenden Variablen:
|
||||
string s1 = "gut";
|
||||
string s2 = "wie";
|
||||
string s3 = "oder";
|
||||
string s4 = "Wie";
|
||||
string s5 = "es";
|
||||
string s6 = "ist";
|
||||
|
||||
|
||||
//Code START
|
||||
s2 = s3 = s4 = s5 = s6;
|
||||
//Code ENDE
|
||||
|
||||
Console.WriteLine(s1);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Exercises/E03_Strings/Exercise_3.cs
Normal file
22
Exercises/E03_Strings/Exercise_3.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_3
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Fügen Sie die Variable DasWarGemeint in den String ausgabeString anstatt der Stelle {0} ein:
|
||||
string DasWarGemeint = "Elefanten";
|
||||
string ausgabeString = "{0} sind die größten Landtiere.";
|
||||
|
||||
//Code START
|
||||
DasWarGemeint = ausgabeString;
|
||||
//Code ENDE
|
||||
|
||||
Console.WriteLine(ausgabeString);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Exercises/E03_Strings/Exercise_4.cs
Normal file
20
Exercises/E03_Strings/Exercise_4.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_4
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Sorgen Sie dafür, dass der String userinput ohne führende und endende Leerzeichen ausgegeben wird:
|
||||
string userinput = " WERT ";
|
||||
//Code START
|
||||
|
||||
//Code ENDE
|
||||
|
||||
Console.WriteLine(userinput);
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Exercises/E03_Strings/Exercise_5.cs
Normal file
24
Exercises/E03_Strings/Exercise_5.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_5
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Geben Sie von folgenden Werten den vierten Buchstaben aus:
|
||||
string firstValue = "Brauerei";
|
||||
string secondValue = "Überbau";
|
||||
string thirdValue = "keinerlei";
|
||||
string fourthValue = "Fairness";
|
||||
|
||||
|
||||
//Code START
|
||||
firstValue = secondValue = thirdValue = fourthValue;
|
||||
//Code ENDE
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
28
Exercises/E03_Strings/Exercise_6.cs
Normal file
28
Exercises/E03_Strings/Exercise_6.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_6
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Sorgen Sie dafür, dass das erste Wort in Großbuchen und in Kleinbuchstaben ausgegeben wird.
|
||||
string val = "hAllIHaLlo";
|
||||
string small;
|
||||
string big;
|
||||
|
||||
|
||||
//Code START
|
||||
small = val;
|
||||
big = val;
|
||||
//Code ENDE
|
||||
|
||||
Console.WriteLine("Kleinbuchstaben:");
|
||||
Console.WriteLine(small);
|
||||
Console.WriteLine("Großbuchstaben:");
|
||||
Console.WriteLine(big);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Exercises/E03_Strings/Exercise_7.cs
Normal file
23
Exercises/E03_Strings/Exercise_7.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_7
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Extrahieren Sie aus dem folgenden String das Wort Polizei
|
||||
string val = " difjPolizei jidf das dielsaö";
|
||||
|
||||
|
||||
//Code START
|
||||
|
||||
|
||||
//Code ENDE
|
||||
|
||||
Console.WriteLine(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Exercises/E03_Strings/Exercise_8.cs
Normal file
25
Exercises/E03_Strings/Exercise_8.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_8
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Sorgen Sie dafür, dass alle drei Strings in einer extra Zeile ausgegeben werden.
|
||||
string val = "Zeile 1";
|
||||
string val2 = "Zeile 2";
|
||||
string val3 = "Zeile 3";
|
||||
|
||||
|
||||
//Code START
|
||||
|
||||
|
||||
//Code ENDE
|
||||
|
||||
Console.WriteLine(val + val2 + val3);
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Exercises/E03_Strings/Exercise_9.cs
Normal file
31
Exercises/E03_Strings/Exercise_9.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Exercises_C_Sharp.E03_Strings
|
||||
{
|
||||
class Exercise_9
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
//Lassen Sie folgende Zeichen(folgen) auf der Konsole ausgeben:
|
||||
// - \
|
||||
// - \n
|
||||
// - \t
|
||||
// - "
|
||||
|
||||
|
||||
//Code START
|
||||
string val = "Element 1";
|
||||
string val2 = "Element 2";
|
||||
string val3 = "Element 3";
|
||||
string val4 = "Element 4";
|
||||
//Code ENDE
|
||||
|
||||
Console.WriteLine(val);
|
||||
Console.WriteLine(val2);
|
||||
Console.WriteLine(val3);
|
||||
Console.WriteLine(val4);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user