0

Now only the first if statement activates

Alright so yesterday I started a calculator script with c++ and had some trouble with the error checking system. I got that down. But now onto the main program as you can see in the code by scrolling down, there are 4 operation sections (mult, div, add, sub) and if you type in 1 1 0 Multiplication, it shows 1 x 1 equals 1 in standard size. But when you enter 1 1 0 division, or addition, or subtraction, only multiplication plays and its like the script is either stopping at mult, which wouldnt make sense, or I did the input wrong. What is wrong with my code that it stop at multiplication? And how would I make it read exactly what the user inputs so that it goes to the right section? https://code.sololearn.com/cofrv27a3p6W/?ref=app

17th Aug 2018, 12:42 AM
Slushie
Slushie - avatar
2 Answers
+ 2
your if statements for your operations are wrong you have if (operation == "Multiplication" || "multiplication") { it has to have a second operation == so it should be if (operation == "Multiplication" || operation == "multiplication") { and the same for the other 3 aswell.
17th Aug 2018, 1:59 AM
Mooaholic
Mooaholic - avatar
+ 1
Ok that fixed it. Thanks.
17th Aug 2018, 2:14 AM
Slushie
Slushie - avatar