-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numbers #10
Open
cecilianyberg
wants to merge
5
commits into
svenrog:master
Choose a base branch
from
cecilianyberg:Numbers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Numbers #10
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}") = "Session02exercise01", "Session02exercise01\Session02exercise01.csproj", "{A6A2F41E-DEEC-4B02-81D0-B8172D365CA0}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{A6A2F41E-DEEC-4B02-81D0-B8172D365CA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A6A2F41E-DEEC-4B02-81D0-B8172D365CA0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A6A2F41E-DEEC-4B02-81D0-B8172D365CA0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A6A2F41E-DEEC-4B02-81D0-B8172D365CA0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {07EFC3EA-3D86-4898-938C-0A6AD3D6F172} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
|
||
namespace Session02Exercise02 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Ange ett antal siffror, separerat med kommatecken."); | ||
var input = Console.ReadLine(); | ||
var inputArray = input.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); | ||
|
||
foreach (var number in inputArray) | ||
{ | ||
Console.WriteLine("Värdet är " + number); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
|
||
namespace Session02Exercise02 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Ange ett antal siffror, separerat med kommatecken."); | ||
var input = Console.ReadLine(); | ||
var inputArray = input.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); | ||
|
||
foreach (var number in inputArray) | ||
{ | ||
Console.WriteLine("Värdet är " + number); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30406.217 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Excercise01", "Session03Excercise01\Session03Excercise01.csproj", "{BF0CB2FF-AAAD-46C4-B03B-44350686714D}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Excercise02", "Session03Excercise02\Session03Excercise02.csproj", "{01C8E8D9-978C-4691-BF80-020EB352DE0D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{BF0CB2FF-AAAD-46C4-B03B-44350686714D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{BF0CB2FF-AAAD-46C4-B03B-44350686714D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{BF0CB2FF-AAAD-46C4-B03B-44350686714D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{BF0CB2FF-AAAD-46C4-B03B-44350686714D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{01C8E8D9-978C-4691-BF80-020EB352DE0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{01C8E8D9-978C-4691-BF80-020EB352DE0D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{01C8E8D9-978C-4691-BF80-020EB352DE0D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{01C8E8D9-978C-4691-BF80-020EB352DE0D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {D3E45702-2874-437E-922B-D41371BDC2CE} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
|
||
namespace Session03Excercise01 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
int[] integerValues = new [] { 1, 2, 3 }; | ||
var integerValuesName = nameof(integerValues); | ||
|
||
for (var i = 0; i < integerValues.Length; i++) | ||
{ | ||
var value = integerValues[i]; | ||
|
||
Console.WriteLine($"Index {i} i arrayen {integerValuesName} har värdet: {value}"); | ||
} | ||
|
||
var doWhileIndex = 0; | ||
|
||
do | ||
{ | ||
var value = integerValues[doWhileIndex]; | ||
|
||
Console.WriteLine($"Do while Index {doWhileIndex} i arrayen {integerValuesName} har värdet: {value}"); | ||
|
||
doWhileIndex++; | ||
} | ||
while (doWhileIndex < integerValues.Length); | ||
|
||
var whileIndex = 0; | ||
|
||
while (whileIndex < integerValues.Length) | ||
{ | ||
var value = integerValues[whileIndex]; | ||
|
||
Console.WriteLine($"While Index {whileIndex} i arrayen {integerValuesName} har värdet: {value}"); | ||
|
||
whileIndex++; | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Session03/Session03/Session03Excercise01/Session03Excercise01.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Linq.Expressions; | ||
|
||
namespace Exercise03 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Ange ett antal siffror, separerat med kommatecken."); | ||
string input = Console.ReadLine(); | ||
string[] inputArray = input.Split(",", StringSplitOptions.RemoveEmptyEntries); | ||
double?[] numberArray = new double?[inputArray.Length]; | ||
|
||
for (int i = 0; i < inputArray.Length; i++) | ||
{ | ||
try | ||
{ | ||
numberArray[i] = Convert.ToDouble(inputArray[i]); | ||
} | ||
catch (Exception) | ||
{ | ||
numberArray[i] = null; | ||
} | ||
} | ||
|
||
//Console.WriteLine("Värdet är " + number); | ||
|
||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Session03/Session03/Session03Excercise02/Session03Excercise02.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prova att göra klart denna övning.
Man behöver loopa igenom
numberArray
igen med en ytterligare for-loop.Sedan behöver du hålla koll på
minValue
,maxValue
,sum
ochcount
.count
skall inte ökas ochsum
skall inte adderasif (numberArray[i] == null)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
För att hoppa vidare i en for-loop kan man använda nyckelordet
continue
.För att komma åt värdet av en nullbar
double
så behöver man skrivanumberArray[i].Value