My Calculator code is not working. Please assist | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

My Calculator code is not working. Please assist

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int operation = 0; int results = 0; Console.WriteLine("Type ypur first number:"); String strFirstNo=Console.ReadLine(); double FirstNo=convert.toDouble("strFirstNo"); Console.WriteLine("Type the second Number"); String strSecondNo = Console.ReadLine(); double SecondNo =Convert.ToDouble("strSecondNo"); Console.WriteLine("Please enter the operator + (Addition), - (Subtraction), / (Divition), *(Multiplication), ^ (Root), % (Remainder):"); String strOperator= Console.ReadLine(); If (strOperator == "Addition" || StrOperator == "+") { Operation=1; } Else If(strOperator== "Subtraction" || strOperator == "-") { Operation= 2; } Else If(strOperator =="Division")|| strOperator == "/") { Operation= 3; } Else If(strOperator == "Multiplication" || strOperator == "*") { Operation = 4; } Else If(strOperator== "^" || strOperator == "Root") { Operation = 5; } Else If(strOperation== "%" || strOperation == "Remainder") } Operation = 6; } Switch (Operation) { Case 1: Result = firstNo + SecondNo; Break; Case 2: Result = FirstNo - SecondNo; Break; Case 3: Result = FirstNo / SecondNo; Break; Case 4: Result = FirstNo * SecondNo; Break Case 5: result = FirstNo ^ SecondNo; Break; Case 6: result = FirstNo % SecondNo; Break; } Concole.WriteLine("\nResult of:" + FirstNo + "" + strOperator + "" + SecondNo + "" + "=" + Result + "."); Console.ReadKey(); } }

5th Sep 2018, 2:24 PM
Xolile Mbuli
2 Answers
+ 1
I have fixed it as far as I could, most of it is working now: https://code.sololearn.com/ckHIQp04EdFl/?ref=app
5th Sep 2018, 3:21 PM
Paul
Paul - avatar
0
Could you link the code?
5th Sep 2018, 3:11 PM
Daniele Bonomi
Daniele Bonomi - avatar