Made it a little bit prettier

This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-19 14:47:41 +01:00
parent 8c82e37a20
commit acfaf64564

View file

@ -6,6 +6,7 @@ while (!string.IsNullOrWhiteSpace(text))
{ {
text = Console.ReadLine(); text = Console.ReadLine();
Console.Clear(); Console.Clear();
Console.WriteLine(String.Format("{0,-6} - {1,-7} - {2,-7}", "Antall", "Bokstav", "Prosent"));
foreach (var character in text.ToLower() ?? string.Empty) foreach (var character in text.ToLower() ?? string.Empty)
{ {
totalLetters++; totalLetters++;
@ -20,7 +21,8 @@ while (!string.IsNullOrWhiteSpace(text))
var character = (char)i; var character = (char)i;
var percentage = 100 * counts[i] / totalLetters ; var percentage = 100 * counts[i] / totalLetters ;
// string output = counts[i] + " - " + character + " - " + percentage + "%"; // string output = counts[i] + " - " + character + " - " + percentage + "%";
Console.WriteLine(String.Format("{0,-3} - {1,1} - {2,2}%", counts[i], character, percentage));
Console.WriteLine(String.Format("{0,-6} - {1,-7} - {2,-7}", counts[i], character, percentage + "%"));
} }
} }
} }