File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 22#include < string>
33
44std::string calculate (const std::string& command, int first, int second) {
5- if (command== " add" ) {
5+ if (command == " add" ) {
66 return std::to_string (first + second);
7- } else if (command== " subtract" ) {
8- return std::to_string (first - second);
9- } else if (command== " multiply" ) {
7+ } else if (command == " subtract" ) {
8+ return std::to_string (first - second);
9+ } else if (command == " multiply" ) {
1010 return std::to_string (first * second);
11- } else if (command== " divide" ) {
11+ } else if (command == " divide" ) {
1212 if (second == 0 ) {
1313 return " Division by 0" ;
1414 } else {
1515 return std::to_string (first / second);
1616 }
17- } else {
17+ } else {
1818 return " Invalid data" ;
19- }
20-
19+ }
2120}
You can’t perform that action at this time.
0 commit comments