We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc5bda0 commit 554ebfaCopy full SHA for 554ebfa
1 file changed
homework/calculate/calculate.hpp
@@ -2,20 +2,19 @@
2
#include <string>
3
4
std::string calculate(const std::string& command, int first, int second) {
5
- if (command=="add") {
+ if (command == "add") {
6
return std::to_string(first + second);
7
- } else if (command=="subtract") {
8
- return std::to_string(first - second);
9
- } else if (command=="multiply") {
+ } else if (command == "subtract") {
+ return std::to_string(first - second);
+ } else if (command == "multiply") {
10
return std::to_string(first * second);
11
- } else if (command=="divide") {
+ } else if (command == "divide") {
12
if (second == 0) {
13
return "Division by 0";
14
} else {
15
return std::to_string(first / second);
16
}
17
- } else {
+ } else {
18
return "Invalid data";
19
- }
20
-
+ }
21
0 commit comments