Exercise

Error messages

Your C++ functions can contain calls to the stop() function to raise an exception. We've partially defined a function add_positive_numbers() for you. Complete this function to raise exceptions.

Instructions

100 XP
  • If x is negative, raise an exception with the message: "x is negative".
  • If y is negative, raise an exception with the message: "y is negative".