Question: 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
Get step-by-step solutions from verified subject matter experts
