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

Merge branch 'division-by-0-fix' into 'fix-div-by-zero'

Fixed division by 0 fixed.

See merge request !2
parents dd600bce 78fca4d7
No related branches found
No related tags found
1 merge request!2Fixed division by 0 fixed.
......@@ -6,7 +6,12 @@
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 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