Share your repls and programming experiences

← Back to all posts
540957 (7)

My attempt at making a calculator using c#

feedback is appreciated

steamsydev (17)

Some points of advice:

  1. When converting the string from Console.ReadLine(), don't use Convert.ToDouble. This won't save you from inputs other than numbers. Use Parse() or TryParse() instead.
  2. Keep the indentation the same throughout the program, this makes it easier to read. Your final if statements have something up with their indentation, but otherwise they work fine.
  3. Try setting Number1, Number2 and Calc to static variables. This will remove the need to send them all within a function call. To do this, move them outside of the main void and into the class by itself, and adding a static before the variable type.

Good job otherwise!

LiamDonohue (74)

btw i suggest making an array so multiple values can be entered

Zexogon (695)

This is awesome :3


there is more better to use switch if your programme nor alot of if else