Initial commit

This commit is contained in:
2018-02-22 23:01:00 +01:00
commit 8a754080ba
378 changed files with 2723 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using System;
class StringReverse {
public static void Main() {
string s = "Norrsken";
string reversed;
reversed = StupidReverse(s);
Console.WriteLine("StupidReverse: " + reversed);
reversed = GoodReverse(s);
Console.WriteLine("GoodReverse: " + reversed);
}
static string StupidReverse(string text) {
char[] charArray = text.ToCharArray();
string reverse = String.Empty;
for (int i = charArray.Length - 1; i >= 0; i--) {
reverse += charArray[i];
}
return reverse;
}
static string GoodReverse(string text) {
char[] charArray = text.ToCharArray();
Array.Reverse(charArray);
return new string(charArray);
}
}