+ 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

23rd Apr 2018, 2:54 AM
RH Tasin
RH Tasin - avatar
3 ответов
23rd Apr 2018, 3:48 AM
Emma
+ 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; }
23rd Apr 2018, 3:48 AM
Neelaksh Singh
Neelaksh Singh - avatar
+ 1
It was helpful for me ☺ Xan
23rd Apr 2018, 5:50 AM
RH Tasin
RH Tasin - avatar