Starting from:
$30

$24

Lab 18 Solution

Objectives:




Handling exceptions within a program



Using try/catch block






Question 1:







Design a program that will repeatedly ask the user to enter student ID (9 digit). If the entered ID is less or greater than 9 digits, the program will throw an exception, generate appropriate error message and terminate. Write this program using the following function declaration:




/**




Prompts the user to input 9 digit WSU student id and returns the id



 



If the length of the student id is < 9 or 9,



a logic_error exception is thrown



*/




string getID();






More products