Commit 67d19616 authored by Nicolas Terreaux's avatar Nicolas Terreaux
Browse files

Clean switch/case (delete break)

parent 1ba57c1d
Pipeline #44182 passed with stages
in 22 seconds
#include <cfloat>
#include <cmath>
#include "Calculator.hpp"
Calculator::Calculator() {
}
Calculator::Calculator() {}
//Try to convert the string to a double and return true if it worked
bool Calculator::check_double(std::string arg) {
......@@ -25,22 +22,16 @@ char Calculator::check_operator(std::string arg) {
switch (arg[0]) {
case '+':
return ADD;
break;
case '-':
return SUB;
break;
case '*':
return MUL;
break;
case '/':
return DIV;
break;
case '#':
return END;
break;
case '%':
return MOD;
break;
default:
return ERR;
}
......@@ -54,10 +45,8 @@ double Calculator::calculate(std::string firstNumber, char oper, std::string sec
switch (oper) {
case ADD:
return number1 + number2;
break;
case MUL:
return number1 * number2;
break;
case DIV:
return number1 / number2;
case SUB:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment