0

[SOLVED] What is wrong

https://code.sololearn.com/c9VCf8GlemYh/?ref=app Iā€™m trying to make a dumb calculator which sums, divides etc. with the user giving him a literal command (razlika means minus its Croatian) but I donā€™t know why it wonā€™t work. Please help I am new to this

5th Mar 2018, 12:57 PM
Marin
Marin - avatar
2 Answers
+ 1
In line 13, remove the semicolon beside the parentheses and insert a closing curly bracket at line 16. In line 17, replace the semicolon with on opening curly bracket. That's all. #include <iostream> using namespace std; int main() { int x; int y; string z; int sum; int razlika; cin >> x; cin >> y; cin >> z; if (z== "zbroj"){ sum = x+y; cout << sum; } else if (z=="razlika"){ razlika= x-y; cout << razlika; }
5th Mar 2018, 1:12 PM
apex137
apex137 - avatar
0
Thanks a bunch nik
5th Mar 2018, 1:16 PM
Marin
Marin - avatar