Skip to content

Commit cb8226f

Browse files
author
ELLIESDATOR\cicci
committed
In progress
1 parent b019444 commit cb8226f

File tree

7 files changed

+159
-0
lines changed

7 files changed

+159
-0
lines changed

Session03/Program.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
3+
namespace Session02Exercise02
4+
{
5+
class Program
6+
{
7+
static void Main(string[] args)
8+
{
9+
Console.WriteLine("Ange ett antal siffror, separerat med kommatecken.");
10+
var input = Console.ReadLine();
11+
var inputArray = input.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
12+
13+
foreach (var number in inputArray)
14+
{
15+
Console.WriteLine("Värdet är " + number);
16+
}
17+
}
18+
}
19+
}

Session03/Session 03.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
3+
namespace Session02Exercise02
4+
{
5+
class Program
6+
{
7+
static void Main(string[] args)
8+
{
9+
Console.WriteLine("Ange ett antal siffror, separerat med kommatecken.");
10+
var input = Console.ReadLine();
11+
var inputArray = input.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
12+
13+
foreach (var number in inputArray)
14+
{
15+
Console.WriteLine("Värdet är " + number);
16+
}
17+
}
18+
}
19+
}

Session03/Session03/Session03.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30406.217
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Excercise01", "Session03Excercise01\Session03Excercise01.csproj", "{BF0CB2FF-AAAD-46C4-B03B-44350686714D}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Excercise02", "Session03Excercise02\Session03Excercise02.csproj", "{01C8E8D9-978C-4691-BF80-020EB352DE0D}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{BF0CB2FF-AAAD-46C4-B03B-44350686714D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{BF0CB2FF-AAAD-46C4-B03B-44350686714D}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{BF0CB2FF-AAAD-46C4-B03B-44350686714D}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{BF0CB2FF-AAAD-46C4-B03B-44350686714D}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{01C8E8D9-978C-4691-BF80-020EB352DE0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{01C8E8D9-978C-4691-BF80-020EB352DE0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{01C8E8D9-978C-4691-BF80-020EB352DE0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{01C8E8D9-978C-4691-BF80-020EB352DE0D}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {D3E45702-2874-437E-922B-D41371BDC2CE}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
3+
namespace Session03Excercise01
4+
{
5+
class Program
6+
{
7+
static void Main(string[] args)
8+
{
9+
int[] integerValues = new [] { 1, 2, 3 };
10+
var integerValuesName = nameof(integerValues);
11+
12+
for (var i = 0; i < integerValues.Length; i++)
13+
{
14+
var value = integerValues[i];
15+
16+
Console.WriteLine($"Index {i} i arrayen {integerValuesName} har värdet: {value}");
17+
}
18+
19+
var doWhileIndex = 0;
20+
21+
do
22+
{
23+
var value = integerValues[doWhileIndex];
24+
25+
Console.WriteLine($"Do while Index {doWhileIndex} i arrayen {integerValuesName} har värdet: {value}");
26+
27+
doWhileIndex++;
28+
}
29+
while (doWhileIndex < integerValues.Length);
30+
31+
var whileIndex = 0;
32+
33+
while (whileIndex < integerValues.Length)
34+
{
35+
var value = integerValues[whileIndex];
36+
37+
Console.WriteLine($"While Index {whileIndex} i arrayen {integerValuesName} har värdet: {value}");
38+
39+
whileIndex++;
40+
}
41+
}
42+
}
43+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Linq.Expressions;
3+
4+
namespace Exercise03
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
Console.WriteLine("Ange ett antal siffror, separerat med kommatecken.");
11+
string input = Console.ReadLine();
12+
string[] inputArray = input.Split(",", StringSplitOptions.RemoveEmptyEntries);
13+
double?[] numberArray = new double?[inputArray.Length];
14+
15+
for (int i = 0; i < inputArray.Length; i++)
16+
{
17+
try
18+
{
19+
numberArray[i] = Convert.ToDouble(inputArray[i]);
20+
}
21+
catch (Exception)
22+
{
23+
numberArray[i] = null;
24+
}
25+
}
26+
27+
//Console.WriteLine("Värdet är " + number);
28+
29+
}
30+
}
31+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>

0 commit comments

Comments
 (0)