Write a function which computes the value of an arithmetic expression. The op should be one of ('+', '-', '*', or '/'). The function should throw an invalid_argument exception otherwise. You should also Also throw an invalid_argument if the op is '/' and the second argument is zero.
#include #include using namespace std;/**Computes the value of an arithmetic expression.@param value1 the first operand@param op a char that should contain an operator + - * or /@param value2 the second operand@return the result of the operation*/int compute(int value1, char op, int value2){...}
/**Computes the value of an arithmetic expression.@param value1 the first operand@param op a char that should contain an operator + - * or /@param value2 the second operand@return the result of the operation*/int compute(int value1, char op, int value2){
...
}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here