Skip to content
Snippets Groups Projects
Commit 139418c8 authored by Florian Steinkamp's avatar Florian Steinkamp
Browse files

Merge branch 'master' into 'master'

remove dead code

See merge request fs878995/rpn_calculator!1
parents cb6dcc2a 215250c9
No related branches found
No related tags found
No related merge requests found
......@@ -56,50 +56,6 @@ int evaluate(const std::string &s) {
throw std::invalid_argument("Ungueltige Anzahl an Zahlen");
}
}
/*switch (c) {
case '+':
if (stack.size() >= 2) {
a = stack.top();
stack.pop();
b = stack.top();
stack.pop();
stack.push(a + b);
}
break;
case '-':
if (stack.size() >= 2) {
a = stack.top();
stack.pop();
b = stack.top();
stack.pop();stack.push(b - a);
}
break;
case '*':
if (stack.size() >= 2) {
a = stack.top();
stack.pop();
b = stack.top();
stack.pop();stack.push(a * b);
}
break;
case '/':
if (stack.size() >= 2) {
a = stack.top();
stack.pop();
b = stack.top();
if (a == 0) {
throw std::invalid_argument("Division durch 0!");
}
stack.pop();stack.push(b / a);
}
break;
default:
if (std::isdigit(c)) {
stack.push(c - '0');
}
break;
}*/
}
if (stack.size() > 1 || stack.size() == 0) {
throw std::invalid_argument("Ungueltige Eingabe");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment