Skip to content
Snippets Groups Projects
Commit 4a7458d7 authored by Damian Puente's avatar Damian Puente
Browse files

Merge branch 'fix-div-by-zero' of https://git.fh-muenster.de/dp173259/rpn_collab

parents 8c57682e bfe2a66e
No related branches found
No related tags found
No related merge requests found
......@@ -6,8 +6,13 @@
int plus( int a, int b) { return a + b; }
int minus( int a, int b) { return a - b; }
int multiply(int a, int b) { return a * b; }
int divide( int a, int b) { return a / b; }
int modulo( int a, int b) { return a % b; }
int divide( int a, int b) {
if(b == 0) {
throw std::invalid_argument("Division by 0.");
}
return a / b;
}
int pop_stack(auto &stack) {
const auto ret{stack.top()};
......
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