Skip to content
Snippets Groups Projects
Commit 23b5a305 authored by Jacek Galowicz's avatar Jacek Galowicz
Browse files

Merge branch 'master' into 'master'

fixed division by zero

See merge request jg943598/rpn_collab!7
parents 1c945b35 9d930dab
No related branches found
No related tags found
No related merge requests found
......@@ -7,9 +7,14 @@
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 power( int a, int b) { return std::pow(a, b); }
int modulo( int a, int b) { return a % b; }
int divide( int a, int b) {
if(b == 0) {
throw std::domain_error("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