From acfaf645646ddbbb3c56a94586aa6beca1590128 Mon Sep 17 00:00:00 2001 From: Geir Okkenhaug Jerstad Date: Tue, 19 Nov 2024 14:47:41 +0100 Subject: [PATCH] Made it a little bit prettier --- Emne 3/ConsoleApp10HvaGjørKoden/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Emne 3/ConsoleApp10HvaGjørKoden/Program.cs b/Emne 3/ConsoleApp10HvaGjørKoden/Program.cs index 4a21952..3ba19fd 100644 --- a/Emne 3/ConsoleApp10HvaGjørKoden/Program.cs +++ b/Emne 3/ConsoleApp10HvaGjørKoden/Program.cs @@ -6,6 +6,7 @@ while (!string.IsNullOrWhiteSpace(text)) { text = Console.ReadLine(); Console.Clear(); + Console.WriteLine(String.Format("{0,-6} - {1,-7} - {2,-7}", "Antall", "Bokstav", "Prosent")); foreach (var character in text.ToLower() ?? string.Empty) { totalLetters++; @@ -20,7 +21,8 @@ while (!string.IsNullOrWhiteSpace(text)) var character = (char)i; var percentage = 100 * counts[i] / totalLetters ; // 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 + "%")); } } } \ No newline at end of file