/* Write a function that takes two numbers and returns if they * should be added, subtracted, multiplied or divided to get 24. * If none of the operations can give 24, return "Invalid". * a change. */ std::string operation(int num1, int num2) { std::string result = "Invalid"; if (num1 + num2 == 24) { result = "added"; } else if ((num1 - num2 == 24) || (num2 - num1 == 24)) { result = "subtracted"; } else if (num1 * num2 == 24) { result = "multiplied"; } else if (((0 != num2) && (num1 / num2 == 24)) || ((0 != num1) && (num2 / num1 == 24))) { result = "divided"; } return result; }