diff --git a/NumbersTest/NumbersTest/NumbersTest.sln b/NumbersTest/NumbersTest/NumbersTest.sln new file mode 100644 index 0000000..81cc888 --- /dev/null +++ b/NumbersTest/NumbersTest/NumbersTest.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NumbersTest", "NumbersTest\NumbersTest.csproj", "{408EA78E-1721-4604-85CC-08B454FA2E3B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {408EA78E-1721-4604-85CC-08B454FA2E3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {408EA78E-1721-4604-85CC-08B454FA2E3B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {408EA78E-1721-4604-85CC-08B454FA2E3B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {408EA78E-1721-4604-85CC-08B454FA2E3B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9E1D9868-8CBD-46CF-854B-B2788774905B} + EndGlobalSection +EndGlobal diff --git a/NumbersTest/NumbersTest/NumbersTest/NumbersTest.csproj b/NumbersTest/NumbersTest/NumbersTest/NumbersTest.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/NumbersTest/NumbersTest/NumbersTest/NumbersTest.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/NumbersTest/NumbersTest/NumbersTest/Program.cs b/NumbersTest/NumbersTest/NumbersTest/Program.cs new file mode 100644 index 0000000..13161c9 --- /dev/null +++ b/NumbersTest/NumbersTest/NumbersTest/Program.cs @@ -0,0 +1,71 @@ +namespace Session03Numbers +{ + using System; + using System.Globalization; + + namespace Session03Exercise02 + { + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Ange ett antal siffror, separat med kommatecken"); + + var input = Console.ReadLine(); + + var inputArray = input.Split(",", StringSplitOptions.RemoveEmptyEntries); + double[] numberArray = new double[inputArray.Length]; + + for (int i = 0; i < inputArray.Length; i++) + { + NumberStyles numberStyles=NumberStyles.Integer + + try + { + numberArray[i] = Convert.ToDouble(inputArray[i]); + } + + catch (Exception) + { + numberArray[i] = 0; + } + + /*/ finally Körs alltid ovasett vad som händer med koden + * Måste vara i en loop /*/ + { + + } + /*/throw new Exception("Provocerat fel") Är ett egenskapat fel/*/ + + foreach (var number in numberArray) + { + Console.WriteLine("Värde: " + number.ToString()); + } + static double GetDoubleValue(string input) + { + try + { + var result = int.Parse(input); + + return result; + } + catch (FormatException ex) when (ex.Message.Contains("Input string")) + { + return double.MinValue; + } + catch (Exception ex) + { + return 0; + } + } + + + + } + } + + } + } +} + + diff --git a/Ny mapp/Session03Exercise01/Session03Exercise01.sln b/Ny mapp/Session03Exercise01/Session03Exercise01.sln new file mode 100644 index 0000000..99d07f7 --- /dev/null +++ b/Ny mapp/Session03Exercise01/Session03Exercise01.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Exercise01", "Session03Exercise01\Session03Exercise01.csproj", "{1DA37EB2-8B33-4F46-9531-0BF485D85D43}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Exercise02", "Session03Exercise02\Session03Exercise02.csproj", "{4EC32C31-2B0E-43AF-AF81-0AE8350D391A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1DA37EB2-8B33-4F46-9531-0BF485D85D43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DA37EB2-8B33-4F46-9531-0BF485D85D43}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DA37EB2-8B33-4F46-9531-0BF485D85D43}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DA37EB2-8B33-4F46-9531-0BF485D85D43}.Release|Any CPU.Build.0 = Release|Any CPU + {4EC32C31-2B0E-43AF-AF81-0AE8350D391A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EC32C31-2B0E-43AF-AF81-0AE8350D391A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EC32C31-2B0E-43AF-AF81-0AE8350D391A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EC32C31-2B0E-43AF-AF81-0AE8350D391A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C3302251-CC54-46F8-8F3E-6513ADE2B657} + EndGlobalSection +EndGlobal diff --git a/Ny mapp/Session03Exercise01/Session03Exercise01/Program.cs b/Ny mapp/Session03Exercise01/Session03Exercise01/Program.cs new file mode 100644 index 0000000..c405287 --- /dev/null +++ b/Ny mapp/Session03Exercise01/Session03Exercise01/Program.cs @@ -0,0 +1,40 @@ +using System; + +namespace Session03Exercise01 +{ + class Program + { + static void Main(string[] args) + { + int[] integerValues = new [] { 1, 2, 3 }; + var integerValueName = nameof(integerValues); + + for (var i = 0; i < integers.Length; i++) + { + var name = nameof(integers); + var value = integers[i]; + + Console.WriteLine($"Index {i} i arrayen {nameof(integers)} har värdet: {integers[i]}"); + } + var doWhileIndex = 0; + + do + { + var value = integerValues[doWhileIndex]; + + Console.WriteLine($"Index{doWhileIndex} i arrayen {integerValueName} har värdet: {value}"); + doWhileIndex++; + } + while (doWhileIndex < integerValues.Length); + + var whileIndex = 0; + + while (whileIndex++ < integersValues < whileIndex) + + Console.WriteLine($"While Index {whileIndex} i arrayen {integerValueName} har värdet: {value}"); + + whileIndex++; + + } + } +} diff --git a/Ny mapp/Session03Exercise01/Session03Exercise01/Session03Exercise01.csproj b/Ny mapp/Session03Exercise01/Session03Exercise01/Session03Exercise01.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Ny mapp/Session03Exercise01/Session03Exercise01/Session03Exercise01.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Ny mapp/Session03Exercise01/Session03Exercise02/Program.cs b/Ny mapp/Session03Exercise01/Session03Exercise02/Program.cs new file mode 100644 index 0000000..3c42c62 --- /dev/null +++ b/Ny mapp/Session03Exercise01/Session03Exercise02/Program.cs @@ -0,0 +1,21 @@ +using System; + +namespace Session03Exercise02 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Ange ett antal siffror, separat med kommatecken"); + + var input = Console.ReadLine(); + + var inputArray = input.Split(",", StringSplitOptions.RemoveEmptyEntries); + + foreach (var number in inputArray) + { + Console.WriteLine("Värdet är " + number); + } + } + } +} diff --git a/Ny mapp/Session03Exercise01/Session03Exercise02/Session03Exercise02.csproj b/Ny mapp/Session03Exercise01/Session03Exercise02/Session03Exercise02.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Ny mapp/Session03Exercise01/Session03Exercise02/Session03Exercise02.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02Example01/Session02Example01/Program.cs b/Session02/Session02Example01/Session02Example01/Program.cs new file mode 100644 index 0000000..97ca4a9 --- /dev/null +++ b/Session02/Session02Example01/Session02Example01/Program.cs @@ -0,0 +1,95 @@ +using System; +using System.Xml.Schema; + +namespace Session02Example01 +{ + class Program + { + static void Main(string[] args) + { + // Binary operation + var additionResult = 1 + 2; + + Console.WriteLine("additionalResult " + additionResult.ToString()); + + var incrementResult = ++additionResult; + + Console.WriteLine("incrementResult " + incrementResult.ToString()); + + var trueValue = true; + + var falseValue = false; + + var andResult = trueValue & falseValue; // 0b0110 + var orResult = trueValue | falseValue; + var xorResult = trueValue ^ falseValue; + + Console.WriteLine("andResult " + andResult); + Console.WriteLine("orResult " + orResult); + Console.WriteLine("xorResult " + xorResult); + + var moduloResult = 7 % 5; + + Console.WriteLine("moduloResult " + moduloResult); + + var highInteger = 1000; + var IntegerDivisionResult = highInteger / 3; + + // Implicit värdekonvertering till double + var doubleDivisionResult = highInteger / 3.0; + + Console.WriteLine("integerDivisionResult " + IntegerDivisionResult); + Console.WriteLine("doubleDivisionResult " + doubleDivisionResult); + + var castIntDivisionResult = (int)(highInteger / 3.0); + + Console.WriteLine("castIntDivisionResults " + castIntDivisionResult); + + var conversionResult = Convert.ToInt32(doubleDivisionResult); + + Console.WriteLine("convertionResult " + conversionResult); + + var midpointDivisionResult = 10.0 / 3.0; + + Console.WriteLine("midpointDivisionResult " + midpointDivisionResult); + Console.WriteLine("castToInt " + ((int)midpointDivisionResult).ToString()); + + Console.WriteLine("ceiling " +Math.Ceiling(midpointDivisionResult)); + Console.WriteLine("floor " + Math.Floor(midpointDivisionResult)); + Console.WriteLine("round " + Math.Round(midpointDivisionResult)); + // Med decimaler + Console.WriteLine("round " + Math.Round(midpointDivisionResult,3)); + + + additionResult += 2; + additionResult -= 2; + additionResult /= 2; + additionResult *= 2; + + //^^ Smidigare sätt än det nedanför. Gör samma sak + + additionResult = additionResult + 2; + + var greaterResult = 5 > 3; + var lessThanResult = 5 < 3; + var greaterOrEqual = 5 >= 3; + var lessOrEqual = 5 <= 3; + + Console.WriteLine("greaterResult " + greaterResult); + Console.WriteLine("lessThanResult " + lessThanResult); + Console.WriteLine("greaterOrEqual " + greaterOrEqual); + Console.WriteLine("lessOrEqual " + lessOrEqual); + + var andOperationResult = true && false; + var orOperationalResult = false || true; + + Console.WriteLine("andOperationalResult " + andOperationResult); + Console.WriteLine("orOperationalResult " + orOperationalResult); + + + + Console.ReadKey(); + + } + } +} diff --git a/Session02/Session02Example02/Session02Example02/Program.cs b/Session02/Session02Example02/Session02Example02/Program.cs new file mode 100644 index 0000000..f2a6a2f --- /dev/null +++ b/Session02/Session02Example02/Session02Example02/Program.cs @@ -0,0 +1,29 @@ +using System; + +namespace Session02Example02 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Ange Ålder: "); + + var input = Console.ReadLine(); + var integer = Convert.ToInt32(input); + + if (integer >= 18) + { + Console.WriteLine("Du får köpa tobaksprodukter"); + } + else + { + Console.WriteLine("Du får inte köpa tobaksprodukter"); + } + + if (integer >= 40) + { + Console.WriteLine("Du är även jättegammal"); + } + } + } +} diff --git a/Session02/Session02Example02/Session02Example02/Session02Example02.csproj b/Session02/Session02Example02/Session02Example02/Session02Example02.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02Example02/Session02Example02/Session02Example02.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02Example03/Session02Example03/Program.cs b/Session02/Session02Example03/Session02Example03/Program.cs new file mode 100644 index 0000000..f6c2f9c --- /dev/null +++ b/Session02/Session02Example03/Session02Example03/Program.cs @@ -0,0 +1,35 @@ +using System; + +namespace Session02Example03 +{ + class Program + { + static void Main(string[] args) + { + var input = Console.ReadLine(); + var integer = Convert.ToInt32(input); + + string waterLabel = integer >= 27 ? "Går bra att bada" : "Går inte att bada"; + + /*/if(integer >27) + { + waterLabel = "Går bra att bada"; + } + else + { + waterLabel = "Går inte bra att bada"; + } + /*/ + + //Om det är dessa exakta värden inträffar + switch (integer) + { + case 1: waterLabel = "Går inte bra att bada alls"; break; + case 3-: waterLabel = "Det är 3 minusgrader"; break; + default: /*Här kan man göra något om inget träffar*/ break; + } + Console.WriteLine(waterLabel + " i havet"); + + } + } +} diff --git a/Session02/Session02Example03/Session02Example03/Session02Example03.csproj b/Session02/Session02Example03/Session02Example03/Session02Example03.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02Example03/Session02Example03/Session02Example03.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02Exercise01/Session02Exercise01.sln b/Session02/Session02Exercise01/Session02Exercise01.sln new file mode 100644 index 0000000..d75bcd4 --- /dev/null +++ b/Session02/Session02Exercise01/Session02Exercise01.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Session02Exercise01", "Session02Exercise01\Session02Exercise01.csproj", "{C7C5AC77-CCBC-40BE-B01E-A04231BF2435}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Exerciese02", "..\Session02Exercise02\Session02Exerciese02\Session02Exerciese02.csproj", "{5D199AF6-E1AC-4316-ACD8-72C33D0F47E7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Example01", "..\Session02Example01\Session02Example01\Session02Example01.csproj", "{0BE5C649-99A1-443F-963B-A4AA9C527A24}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Example02", "..\Session02Example02\Session02Example02\Session02Example02.csproj", "{B9F20334-BBF4-425D-A266-EED6BD88E17E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Example03", "..\Session02Example03\Session02Example03\Session02Example03.csproj", "{2FE6A791-64C2-4570-AD03-BF45214E8853}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C7C5AC77-CCBC-40BE-B01E-A04231BF2435}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7C5AC77-CCBC-40BE-B01E-A04231BF2435}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7C5AC77-CCBC-40BE-B01E-A04231BF2435}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7C5AC77-CCBC-40BE-B01E-A04231BF2435}.Release|Any CPU.Build.0 = Release|Any CPU + {5D199AF6-E1AC-4316-ACD8-72C33D0F47E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D199AF6-E1AC-4316-ACD8-72C33D0F47E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D199AF6-E1AC-4316-ACD8-72C33D0F47E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D199AF6-E1AC-4316-ACD8-72C33D0F47E7}.Release|Any CPU.Build.0 = Release|Any CPU + {0BE5C649-99A1-443F-963B-A4AA9C527A24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0BE5C649-99A1-443F-963B-A4AA9C527A24}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0BE5C649-99A1-443F-963B-A4AA9C527A24}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0BE5C649-99A1-443F-963B-A4AA9C527A24}.Release|Any CPU.Build.0 = Release|Any CPU + {B9F20334-BBF4-425D-A266-EED6BD88E17E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9F20334-BBF4-425D-A266-EED6BD88E17E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9F20334-BBF4-425D-A266-EED6BD88E17E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9F20334-BBF4-425D-A266-EED6BD88E17E}.Release|Any CPU.Build.0 = Release|Any CPU + {2FE6A791-64C2-4570-AD03-BF45214E8853}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2FE6A791-64C2-4570-AD03-BF45214E8853}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2FE6A791-64C2-4570-AD03-BF45214E8853}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2FE6A791-64C2-4570-AD03-BF45214E8853}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EAD30D92-EF25-4EBE-9F49-6117BC2B0E6F} + EndGlobalSection +EndGlobal diff --git a/Session02/Session02Exercise01/Session02Exercise01/Program.cs b/Session02/Session02Exercise01/Session02Exercise01/Program.cs new file mode 100644 index 0000000..55be8c4 --- /dev/null +++ b/Session02/Session02Exercise01/Session02Exercise01/Program.cs @@ -0,0 +1,20 @@ +using System; + +namespace Session02Exercise01 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + + var integer = 0; + + Console.WriteLine("Integer is " + integer.ToString()); + string stringValue = "MyStringValue"; + + Console.WriteLine("The value of stringValue is:" + stringValue); + + } + } + } \ No newline at end of file diff --git a/Session02/Session02Exercise01/Session02Exercise01/Session02Exercise01.csproj b/Session02/Session02Exercise01/Session02Exercise01/Session02Exercise01.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02Exercise01/Session02Exercise01/Session02Exercise01.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session02/Session02Exercise02/Session02Exerciese02/Program.cs b/Session02/Session02Exercise02/Session02Exerciese02/Program.cs new file mode 100644 index 0000000..6613483 --- /dev/null +++ b/Session02/Session02Exercise02/Session02Exerciese02/Program.cs @@ -0,0 +1,24 @@ +using System; + +namespace Session02Exerciese02 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Do you want to enter your name? (y/n)"); + var key = Console.ReadKey(); + + if (key.KeyChar == 'n') + return; + + + + Console.WriteLine("Enter your name:"); + var name = Console.ReadLine(); + + Console.WriteLine("Hello, " + name); + Console.ReadKey(); + } + } +} diff --git a/Session02/Session02Exercise02/Session02Exerciese02/Session02Exerciese02.csproj b/Session02/Session02Exercise02/Session02Exerciese02/Session02Exerciese02.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session02/Session02Exercise02/Session02Exerciese02/Session02Exerciese02.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session03/Session03Exercise01/Session03Exercise01.sln b/Session03/Session03Exercise01/Session03Exercise01.sln new file mode 100644 index 0000000..298d70a --- /dev/null +++ b/Session03/Session03Exercise01/Session03Exercise01.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Session03Exercise01", "Session03Exercise01\Session03Exercise01.csproj", "{1DA37EB2-8B33-4F46-9531-0BF485D85D43}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Session03Exercise02", "Session03Exercise02\Session03Exercise02.csproj", "{4EC32C31-2B0E-43AF-AF81-0AE8350D391A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Numbers", "Session03Numbers\Session03Numbers.csproj", "{1C6E64D2-5B10-4FAB-BF60-9EF1887357B9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1DA37EB2-8B33-4F46-9531-0BF485D85D43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DA37EB2-8B33-4F46-9531-0BF485D85D43}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DA37EB2-8B33-4F46-9531-0BF485D85D43}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DA37EB2-8B33-4F46-9531-0BF485D85D43}.Release|Any CPU.Build.0 = Release|Any CPU + {4EC32C31-2B0E-43AF-AF81-0AE8350D391A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EC32C31-2B0E-43AF-AF81-0AE8350D391A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EC32C31-2B0E-43AF-AF81-0AE8350D391A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EC32C31-2B0E-43AF-AF81-0AE8350D391A}.Release|Any CPU.Build.0 = Release|Any CPU + {1C6E64D2-5B10-4FAB-BF60-9EF1887357B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C6E64D2-5B10-4FAB-BF60-9EF1887357B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C6E64D2-5B10-4FAB-BF60-9EF1887357B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C6E64D2-5B10-4FAB-BF60-9EF1887357B9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C3302251-CC54-46F8-8F3E-6513ADE2B657} + EndGlobalSection +EndGlobal diff --git a/Session03/Session03Exercise01/Session03Exercise01/Program.cs b/Session03/Session03Exercise01/Session03Exercise01/Program.cs new file mode 100644 index 0000000..c405287 --- /dev/null +++ b/Session03/Session03Exercise01/Session03Exercise01/Program.cs @@ -0,0 +1,40 @@ +using System; + +namespace Session03Exercise01 +{ + class Program + { + static void Main(string[] args) + { + int[] integerValues = new [] { 1, 2, 3 }; + var integerValueName = nameof(integerValues); + + for (var i = 0; i < integers.Length; i++) + { + var name = nameof(integers); + var value = integers[i]; + + Console.WriteLine($"Index {i} i arrayen {nameof(integers)} har värdet: {integers[i]}"); + } + var doWhileIndex = 0; + + do + { + var value = integerValues[doWhileIndex]; + + Console.WriteLine($"Index{doWhileIndex} i arrayen {integerValueName} har värdet: {value}"); + doWhileIndex++; + } + while (doWhileIndex < integerValues.Length); + + var whileIndex = 0; + + while (whileIndex++ < integersValues < whileIndex) + + Console.WriteLine($"While Index {whileIndex} i arrayen {integerValueName} har värdet: {value}"); + + whileIndex++; + + } + } +} diff --git a/Session03/Session03Exercise01/Session03Exercise01/Session03Exercise01.csproj b/Session03/Session03Exercise01/Session03Exercise01/Session03Exercise01.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session03/Session03Exercise01/Session03Exercise01/Session03Exercise01.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session03/Session03Exercise01/Session03Exercise02/Program.cs b/Session03/Session03Exercise01/Session03Exercise02/Program.cs new file mode 100644 index 0000000..3c42c62 --- /dev/null +++ b/Session03/Session03Exercise01/Session03Exercise02/Program.cs @@ -0,0 +1,21 @@ +using System; + +namespace Session03Exercise02 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Ange ett antal siffror, separat med kommatecken"); + + var input = Console.ReadLine(); + + var inputArray = input.Split(",", StringSplitOptions.RemoveEmptyEntries); + + foreach (var number in inputArray) + { + Console.WriteLine("Värdet är " + number); + } + } + } +} diff --git a/Session03/Session03Exercise01/Session03Exercise02/Session03Exercise02.csproj b/Session03/Session03Exercise01/Session03Exercise02/Session03Exercise02.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session03/Session03Exercise01/Session03Exercise02/Session03Exercise02.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Session03/Session03Exercise01/Session03Numbers/Program.cs b/Session03/Session03Exercise01/Session03Numbers/Program.cs new file mode 100644 index 0000000..940dd68 --- /dev/null +++ b/Session03/Session03Exercise01/Session03Numbers/Program.cs @@ -0,0 +1,55 @@ +using System; + +namespace Session03Numbers +{ + using System; + + namespace Session03Exercise02 + { + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Ange ett antal siffror, separat med kommatecken"); + + var input = Console.ReadLine(); + + var inputArray = input.Split(",", StringSplitOptions.RemoveEmptyEntries); + + + foreach (var number in inputArray) + { + Console.WriteLine("Värdet är " + number); + } + using System; + +namespace Session03Numbers +{ + using System; + + namespace Session03Exercise02 + { + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Ange ett antal siffror, separat med kommatecken"); + + var input = Console.ReadLine(); + + var inputArray = input.Split(",", StringSplitOptions.RemoveEmptyEntries); + + foreach (var number in inputArray) + { + Console.WriteLine("Värdet är " + number); + } + int lowestValue = (inputArray + 5); + + Console.WriteLine("Lägsta värdet är: " + lowestValue); + } + } + } + + } + } + } diff --git a/Session03/Session03Exercise01/Session03Numbers/Session03Numbers.csproj b/Session03/Session03Exercise01/Session03Numbers/Session03Numbers.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Session03/Session03Exercise01/Session03Numbers/Session03Numbers.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + +