My attempt at making a calculator using c#
feedback is appreciated
You are viewing a single comment. View All
Some points of advice:
- 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.
- 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.
- 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!