diff --git a/Emne 3/ConsoleApp1/ConsoleApp1/MyConsole.cs b/Emne 3/ConsoleApp1/ConsoleApp1/MyConsole.cs new file mode 100644 index 0000000..cd7de1f --- /dev/null +++ b/Emne 3/ConsoleApp1/ConsoleApp1/MyConsole.cs @@ -0,0 +1,12 @@ +namespace ConsoleApp1; + +public class MyConsole +{ + + public static string Ask(string question) + { + Console.Write(question); + return Console.ReadLine(); + } + +} \ No newline at end of file diff --git a/Emne 3/ConsoleApp1/ConsoleApp1/Program.cs b/Emne 3/ConsoleApp1/ConsoleApp1/Program.cs index 36022e5..de396c0 100644 --- a/Emne 3/ConsoleApp1/ConsoleApp1/Program.cs +++ b/Emne 3/ConsoleApp1/ConsoleApp1/Program.cs @@ -4,10 +4,13 @@ internal class Program { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + + var name = MyConsole.Ask("What is your name?"); + Console.WriteLine($"Hello {name}!"); var number = GetNumber(); } + static int GetNumber() { return 7;