Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 16.1, Problem 1STE
Program Plan Intro

Exception:

An exception is a problem that creates during the execution of a program; it offers a method to transfer control from one part to another part of a program.

An exception handling is created by using the following three keywords such as try, catch and throw.

  • The “try” block have the program for the basic algorithm that says the computer what to do when all goes well.
  • The “throw” keyword throws an error statement to the “catch” block.
  • The “catch” block will catch the exception or handling the exception.

Generally, the compiler executes “try” block. In the “try” block, if the statements cause an exception, it throws an error statement to the “catch” block using the keyword “throw”. The “catch” block then handles the error based upon the type of exception.

Blurred answer
Students have asked these similar questions
use C++ programing language  Write a program that prompts the user to enter a person's date of birth in numeric form such as 8-27-1980. The program then outputs the date of birth in the form: August 27, 1980. Your program must contain at least two exception classes: invalidDay and invalidMonth. If the user enters an invalid value for day, then the program should throw and catch an invalidDay object. Similar conventions for the invalid values of month and year. (Note that your program must handle a leap year.)
There is no maximum number of arguments that may be used inside a catch block since this kind of block does not have a parameter restriction.
There is no limit on the amount of arguments in a catch block.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT