Challenge 1: A Function That Throws on a Negative Input — Possible Solution ==================================================================== #include #include void check_positive(int value) { if (value < 0) { throw std::runtime_error("value must not be negative"); } std::cout << "Value is fine: " << value << std::endl; } int main() { try { check_positive(-5); } catch (const std::exception &e) { std::cout << "Caught: " << e.what() << std::endl; } return 0; } Output: Caught: value must not be negative WHY THIS WORKS AS AN ANSWER ------------------------------ check_positive(-5) triggers the throw std::runtime_error(...) line before ever reaching the "fine" message, and control transfers immediately to the matching catch (const std::exception&) block in main -- e.what() returns the message string passed to the runtime_error's own constructor, confirming the exception carried the correct information through to the catch site.