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 2
2
#include < string>
3
3
4
4
std::string calculate (const std::string& command, int first, int second) {
5
- if (command== " add" ) {
5
+ if (command == " add" ) {
6
6
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" ) {
10
10
return std::to_string (first * second);
11
- } else if (command== " divide" ) {
11
+ } else if (command == " divide" ) {
12
12
if (second == 0 ) {
13
13
return " Division by 0" ;
14
14
} else {
15
15
return std::to_string (first / second);
16
16
}
17
- } else {
17
+ } else {
18
18
return " Invalid data" ;
19
- }
20
-
19
+ }
21
20
}
You can’t perform that action at this time.
0 commit comments