Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134521176
Author: SAVITCH
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 16.2, Problem 11STE
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
Explain the difference between a try block and a catch block.
Is it possible to include a try block and its associated catch blocks inside a larger catch block?
If an exception is thrown outside a try block, what are the probable outcomes?
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.
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,