-
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 app #14
Open
TooOldForThisGit
wants to merge
17
commits into
svenrog:master
Choose a base branch
from
TooOldForThisGit: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 app #14
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b246f28
Initialize a commit.
TooOldForThisGit b6aacca
Initialize commit.
TooOldForThisGit 1618ce9
Initailize commit3
TooOldForThisGit 0eea425
Testing intergers
TooOldForThisGit 8676557
Stringtest
TooOldForThisGit d2296f3
Stringtest
TooOldForThisGit 0481b5b
Commit nameinput.
TooOldForThisGit dfb7d60
Nameinput commit.
TooOldForThisGit a82686a
Initialize commit - Session02
TooOldForThisGit 1a9340c
Testing integer.
TooOldForThisGit a27e590
String test
TooOldForThisGit eaf85d8
Merge Develop and Test.
TooOldForThisGit e11cde4
Session 03 - Exercises
TooOldForThisGit 01907ae
Progress on number app
TooOldForThisGit 9756e9e
Merge branch 'master' of https://github.com/svenrog/csharp-plus-2020 …
TooOldForThisGit ade67d7
Value input based on WordApp commit
TooOldForThisGit 32b1e01
Minor fix in inputvalue commit
TooOldForThisGit 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,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,23 @@ | ||
using System; | ||
|
||
namespace Exercise01 | ||
{ | ||
class Nameprogram | ||
{ | ||
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(); | ||
|
||
} | ||
} | ||
} |
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.30330.147 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Session02Exercise01", "Session02Exercise01\Session02Exercise01.csproj", "{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercise01", "Exercise01\Exercise01.csproj", "{A006EB6B-4575-4218-8515-908D59C38027}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{7AD8F7EE-EE2F-4406-83B8-175E47A055BA}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{A006EB6B-4575-4218-8515-908D59C38027}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A006EB6B-4575-4218-8515-908D59C38027}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A006EB6B-4575-4218-8515-908D59C38027}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A006EB6B-4575-4218-8515-908D59C38027}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {A01846C8-7967-4D9C-BFB6-B277CE9B5BFB} | ||
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,16 @@ | ||
using System; | ||
|
||
namespace Session02Exercise01 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Hello World!"); | ||
|
||
|
||
Console.ReadLine(); | ||
|
||
} | ||
} | ||
} |
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,25 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30330.147 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session03Exercise02", "Session03Exercise02\Session03Exercise02.csproj", "{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{AC8EF63F-B225-4D1A-AB4E-0DED2349D8CD}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {F9EA986A-D463-4C01-AAE3-D2F92EF01A3C} | ||
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,64 @@ | ||
| ||
using System; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
using System.Linq; | ||
|
||
namespace Session03Exercise02 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Ange ett antal siffron, separat med kommatecken."); | ||
var input = Console.ReadLine(); | ||
|
||
var inputArray = input.Split(',', StringSplitOptions.RemoveEmptyEntries);//new [] för FrameWork | ||
foreach (var number in inputArray) | ||
{ | ||
Console.WriteLine("Värdet är " + number); | ||
} | ||
|
||
Console.ReadKey(); | ||
|
||
Console.WriteLine("Ange ett antal siffror, separat med kommatecken."); | ||
var inputNumber = Console.ReadLine(); | ||
|
||
var inputStringArray = inputNumber.Split(',', StringSplitOptions.RemoveEmptyEntries);//new [] för FrameWork | ||
var numbers = new double[inputStringArray.Length]; | ||
double middlevalue = 0; | ||
|
||
//while() | ||
for (int i = 0; i < inputStringArray.Length; i++) | ||
{ | ||
Console.WriteLine("Värdet är:".PadRight(14) + inputStringArray[i]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Att använda metodaccess direkt följande literaler på detta sättet är något vi anser påverkar läsbarheten i kod. Skriv istället:
|
||
try | ||
{ | ||
double currentNumber = 0; | ||
NumberStyles numberStyles = NumberStyles.Any | NumberStyles.Float; //bitwiseoperator | ||
bool parsed = Double.TryParse(inputStringArray[i], numberStyles, CultureInfo.InvariantCulture, out currentNumber); | ||
if (parsed) | ||
{ | ||
numbers[i] = currentNumber; | ||
middlevalue += currentNumber; | ||
} | ||
else continue; | ||
|
||
// Debug.Assert(i < numbers.Length - 1); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e); | ||
throw; | ||
} | ||
|
||
} | ||
Console.WriteLine("-------------------------------------------\n"); | ||
Console.WriteLine($"Högsta värdet: {numbers.Max()}");//Max value | ||
Console.WriteLine($"Minsta värdet: {numbers.Min()}");//Min value | ||
Console.WriteLine("Medelvärdet för arrayen är: " + string.Format($"{(middlevalue / numbers.Length):0.00}")); //Middle value | ||
Console.ReadKey(); | ||
|
||
} | ||
} | ||
} |
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,25 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30330.147 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Session02Exercise01", "Session02Exercise01\Session02Exercise01.csproj", "{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D43377BC-B59A-4BC3-9C2B-E8A1E15DECC3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {BE13223B-EA03-4564-8DF3-0ADFF6760509} | ||
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,19 @@ | ||
using System; | ||
|
||
namespace Session02Exercise01 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Hello World!"); | ||
|
||
var integer = 0; | ||
string stringValue = "Mystringvalue"; | ||
|
||
Console.WriteLine("Integer is: " + integer); | ||
Console.WriteLine("value of my stringvalue: " + stringValue); | ||
|
||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Session2/Session02/Session02Exercise01/Session02Exercise01.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> |
Submodule csharp-plus-2020
added at
f0bd65
Submodule sharp_projects
added at
dfb7d6
Submodule srctreeclone
added at
217703
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 använda en nullbar datatyp här för att hålla reda på om
Double.TryParse
lyckats eller inte. Om man inte gör det påverkas snittet.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.
Mer om nullable här:
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-value-types