+ 1
can I do this with if...else in spite of switch?
please check the code and tell me is it possible to make a calculetor like this using if....else. How it has to work : if I input 2+3 (a=2,b=3) output will be 5 or if I input 4*5 output will be 20 the logic I use here is, "if input 5+7 mean a+b sum will be 'sum=a+b' and result will be 13, but its not working I don't understand how to take input this '+'... is + char? so guys give me a good solution to make this code workable please ☺ https://code.sololearn.com/c62JdSCCgZsk/?ref=app https://code.sololearn
3 odpowiedzi
+ 2
I've adapted your code:
https://code.sololearn.com/cQOjs1uWIw58/?ref=app
+ 1
You can define words
like add, sub, mult, div for operations .
I user inputs add then you specify condition a+b in if
EXAMPLE-if(input=='add')
{output=a+b;
cout<<output;
}
+ 1
It was helpful for me ☺ Xan