diff --git a/Emne 3/ConsoleApp2/ConsoleApp2/NewClass.cs b/Emne 3/ConsoleApp2/ConsoleApp2/NewClass.cs index b79b4b9..0938b34 100644 --- a/Emne 3/ConsoleApp2/ConsoleApp2/NewClass.cs +++ b/Emne 3/ConsoleApp2/ConsoleApp2/NewClass.cs @@ -2,23 +2,17 @@ namespace ConsoleApp2; public class NewClass { - private int tall = 1; - private float desimalTall = 1.0f; - double desimalTall2 = 1.01; - decimal desimalTall3 = 1.01M; + public static int nummer = 1; + public static long langt = 1234567890; + public static float flytende = 5.5f; + public static decimal desimal = 1.5m; + public static double dobbel = 1.5; + public static string streng = "Bokstaver og ord"; + public static char karakter = 'A'; + public static bool santUsant = false; - char bokstav = 'A'; - string tekst = "Hei"; - - bool santUsant = true; //eller false - - int[] tallArray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - string[] tekstArray = { "A", "B", "C", "D", "E" }; - - List ListeMedTall = new List(); - - public int NumberFive() + public string NumberFive() { - return 5; + return "fem"; } } \ No newline at end of file diff --git a/Emne 3/ConsoleApp2/ConsoleApp2/Program.cs b/Emne 3/ConsoleApp2/ConsoleApp2/Program.cs index 11eae69..534d3e0 100644 --- a/Emne 3/ConsoleApp2/ConsoleApp2/Program.cs +++ b/Emne 3/ConsoleApp2/ConsoleApp2/Program.cs @@ -7,7 +7,11 @@ internal class Program Console.WriteLine("Hei, hva heter du?"); var input = Console.ReadLine(); Console.WriteLine($"Velkommen {input}!"); - Console.WriteLine(NewClass.bokstav); + Console.WriteLine($"{NewClass.nummer}"); + Console.WriteLine($"{NewClass.flytende}"); + Console.WriteLine($"{NewClass.desimal}"); + Console.WriteLine($"{NewClass.dobbel}"); + Console.WriteLine($"{NewClass.streng}"); } } diff --git a/Emne 3/ConsoleApp3/ConsoleApp3.sln b/Emne 3/ConsoleApp3/ConsoleApp3.sln new file mode 100644 index 0000000..b216b5c --- /dev/null +++ b/Emne 3/ConsoleApp3/ConsoleApp3.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp3", "ConsoleApp3\ConsoleApp3.csproj", "{0F0F3523-8CAA-4458-BC02-5F3BF326548F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0F0F3523-8CAA-4458-BC02-5F3BF326548F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F0F3523-8CAA-4458-BC02-5F3BF326548F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F0F3523-8CAA-4458-BC02-5F3BF326548F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F0F3523-8CAA-4458-BC02-5F3BF326548F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Emne 3/ConsoleApp3/ConsoleApp3/ConsoleApp3.csproj b/Emne 3/ConsoleApp3/ConsoleApp3/ConsoleApp3.csproj new file mode 100644 index 0000000..2f4fc77 --- /dev/null +++ b/Emne 3/ConsoleApp3/ConsoleApp3/ConsoleApp3.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Emne 3/ConsoleApp3/ConsoleApp3/Program.cs b/Emne 3/ConsoleApp3/ConsoleApp3/Program.cs new file mode 100644 index 0000000..85551be --- /dev/null +++ b/Emne 3/ConsoleApp3/ConsoleApp3/Program.cs @@ -0,0 +1,13 @@ +namespace ConsoleApp3 +{ + internal class Program + { + static void Main(string[] args) + { + int a = 3; + decimal b = 5; + decimal sum = a + b; + Console.WriteLine(sum); + } + } +} \ No newline at end of file