Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ format: Write a function that accepts an integer parameter and returns its integer square root. The function should throw one of the following
In C++ format: Write a function that accepts an integer parameter and returns its integer square root. The function should throw one of the following standard exceptions (or 0) if one of the associated conditions are met with the related strings passed to the whatQ function: r: "Error: Supplied integer is negative!" throw domain erro throw 0: "Error: Supplied integer is zero!". throw invalid argument: "Error: Supplied integer is not a perfect square!" Demonstrate the function with a suitable main function driver using user input and try/catch blocks, printing out any exception error strings (using the what0 member function, or your own statement given 0). The main function exits with the corresponding return code or 0 if successful Main function return codes: 0: It was passed a valid number. 1: It is passed a negative integer. 2: It is passed the integer 0. 3: It is passed an integer that is not a perfect square
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started