Skip to content

Number app#18

Open
fabbemannen wants to merge 4 commits into
svenrog:masterfrom
fabbemannen:numbers
Open

Number app#18
fabbemannen wants to merge 4 commits into
svenrog:masterfrom
fabbemannen:numbers

Conversation

@fabbemannen

Copy link
Copy Markdown

Exercise in numbers. It currently doesn't edit out faulty entries, but instead ignores them.

//Set color and then reset it after the error
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(" ERROR: FORMAT EXCEPTION");
Console.ResetColor();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roligt med färger!

Console.WriteLine();
}

Console.WriteLine("Total: " + inputTotal + " Average: " + Math.Round(inputTotal / (double)inputLength, 3));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saknar max och minvärde.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, missade att man skulle ha det också. Ska jag uppdatera med det eller ska jag låta det vara för den här gången?

Jag hade troligen gjort nånting i stil med
if(maxValue < numberParse) { maxValue = numberParse; }
i TryParse if-satsen på rad 25 (och med ett minValue).

Ser att jag hade nån onödig convert to double där också.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja, du fattar principen, behövs ej. Jag hade skrivit numberParse > maxValue (samma sak, men min hjärna läser det lättare).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants