Skip to content

Number app #18

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Number app #18

wants to merge 4 commits into from

Conversation

fabbemannen
Copy link

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
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
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
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
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