Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

And the contents of the operation.cpp looks like this:

Code Block
languagecpp
themeMidnight
titleoperations.cpp
linenumberstrue
#include "operations.h"

float divide(int numerator, int denominator){
    if(denominator == 0){
        throw std::overflow_error("Divide by zero exception!!! Verify the denominator value!");
    }
    return float(numerator) / float(denominator);
}

float divide(float numerator, float denominator){
    if(abs(denominator) <= 1e-5){
        throw std::overflow_error("Divide by zero exception!!! The denominator value close to zero!");
    }
    return numerator / denominator;
}

...