wes d2a2ba9e15 first commit | há 4 anos atrás | |
---|---|---|
.. | ||
README.md | há 4 anos atrás | |
code.cpp | há 4 anos atrás | |
unitTest.cpp | há 4 anos atrás |
by Matt tags: algebra, math, numbers
Create a function that takes two numbers and a mathematical operator + - / * and will perform a calculation with the given numbers. Examples calculator(2, '+', 2) ➞ 4 calculator(2, '*', 2) ➞ 4 calculator(4, '/', 2) ➞ 2 Notes If the input tries to divide by 0, return 0.
Create a function that takes two numbers and a mathematical operator + - / *
and will perform a calculation with the given numbers.
calculator(2, '+', 2) ➞ 4
calculator(2, '*', 2) ➞ 4
calculator(4, '/', 2) ➞ 2
If the input tries to divide by 0, return 0
.