Question: Integer cylinderHeight is read from input. Complete the try block to throw a runtime error exception with the message Your input cannot be processed if
Integer cylinderHeight is read from input. Complete the try block to throw a runtime error exception with the message "Your input cannot be processed" if cylinderHeight is 0.
Ex: If input is 74, then the output is:
Cylinder's height submitted: 74
Ex: If input is -44, then the output is:
Error: Your input cannot be processed
#include
int main() { int cylinderHeight;
cin >> cylinderHeight;
try { if (cylinderHeight <= 0) { throw /* Your code goes here */; } cout << "Cylinder's height submitted: " << cylinderHeight << endl; } catch (runtime_error& excpt) { cout << "Error: " << excpt.what() << endl; }
return 0; }
c++ and please please make it correct
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
