SlideShare a Scribd company logo
3
Most read
7
Most read
8
Most read
1
CONTENT :
• INTRODUCTION
• TRY ,THROW,CATCH
• SYNTAX
• EXAMPLE
2
INTRODUCTION :
Exception Handling :
It is a way of handling error which occure while executing
program.
Exception are run time unusual condition that a program may
encounter while executing..
This unusual condition includes condition such as “division by
zero”,””, or “running out of memory or disk space”.
3
CONTIN….
TRY :
It is one of the block in which we write the block of
statements which causes executions at run time in
other words try block always contains problematic
statements.
4
CONTIN….
THROW BLOCK:
5
A throw expression signals that an exceptional
condition—often, an error—has occurred in a try block
CONTIN….
CATCH BLOCK:
It is one of the block in which we write the block of
statements which will generates user friendly error
messages in other words catch block will suppose system
error messages.
6
In an program a block of code which can produce error is placed in try block
When an exception is detected in try it is thrown using throw statement
Syntax
try
{
throw exception;
}
catch(type argument)
{
}
SYNTAX
7
Relating exception handling with real life
If a Smartphone fails the
test
try throw
catch
8
PROGRAM
#include <iostream>
#include <conio.h>
using namespace std;
Int main()
{
 int dividend, divisor, quotient;
 try
 {
 cout << " Enter the dividend: ";
 cin >> dividend;
 cout << "Enter the divisor: ";
9
CONTIN…..
 cin >> divisor;
 if (divisor == 0)
 throw divisor;
 quotient = dividend / divisor;
 cout << "Quotient = " << quotient << endl;
 }
 catch (int x)
 {
cout << "Division by "<< x << endl;
 }
}
10
PROGRAM
exception.cpp
11
Thank you
12

More Related Content

What's hot (20)

PDF
Constructors and Destructors
Dr Sukhpal Singh Gill
 
PPTX
Inline function in C++
Learn By Watch
 
PPT
Exception handling in java
Pratik Soares
 
PPTX
Strings in c++
Neeru Mittal
 
PPTX
Polymorphism in c++(ppt)
Sanjit Shaw
 
PPTX
Types of Constructor in C++
Bhavik Vashi
 
PPTX
Function overloading
Selvin Josy Bai Somu
 
DOC
Time and space complexity
Ankit Katiyar
 
PPTX
Java package
CS_GDRCST
 
PDF
Lesson 03 python statement, indentation and comments
Nilimesh Halder
 
PPTX
Inheritance in java
RahulAnanda1
 
PPTX
Static Data Members and Member Functions
MOHIT AGARWAL
 
PPTX
Abstract Data Types
karthikeyanC40
 
PPTX
Recursive Function
Harsh Pathak
 
PDF
What is Multithreading In Python | Python Multithreading Tutorial | Edureka
Edureka!
 
PPTX
Java exception handling
BHUVIJAYAVELU
 
PPS
Java Exception handling
kamal kotecha
 
PPTX
Functions in c++
Rokonuzzaman Rony
 
PPT
C++ classes tutorials
Mayank Jain
 
PPTX
Type casting in java
Farooq Baloch
 
Constructors and Destructors
Dr Sukhpal Singh Gill
 
Inline function in C++
Learn By Watch
 
Exception handling in java
Pratik Soares
 
Strings in c++
Neeru Mittal
 
Polymorphism in c++(ppt)
Sanjit Shaw
 
Types of Constructor in C++
Bhavik Vashi
 
Function overloading
Selvin Josy Bai Somu
 
Time and space complexity
Ankit Katiyar
 
Java package
CS_GDRCST
 
Lesson 03 python statement, indentation and comments
Nilimesh Halder
 
Inheritance in java
RahulAnanda1
 
Static Data Members and Member Functions
MOHIT AGARWAL
 
Abstract Data Types
karthikeyanC40
 
Recursive Function
Harsh Pathak
 
What is Multithreading In Python | Python Multithreading Tutorial | Edureka
Edureka!
 
Java exception handling
BHUVIJAYAVELU
 
Java Exception handling
kamal kotecha
 
Functions in c++
Rokonuzzaman Rony
 
C++ classes tutorials
Mayank Jain
 
Type casting in java
Farooq Baloch
 

Similar to Exception handling in c++ (20)

PPTX
exception handling
rajshreemuthiah
 
PPTX
Web technology
Siva Priya
 
PDF
22 scheme OOPs with C++ BCS306B_module5.pdf
sindhus795217
 
PPTX
Exceptions in C++ Object Oriented Programming.pptx
estorebackupr
 
PPTX
Exception handling
Waqas Abbasi
 
PPTX
Maheen oop
mahshah212
 
PDF
Exceptions and Exception Handling in C++
IRJET Journal
 
PPT
F6dc1 session6 c++
Mukund Trivedi
 
PPTX
Lecture 3.1.1 Try Throw Catch.pptx
sunilsoni446112
 
PPTX
exception handling in cpp
gourav kottawar
 
PDF
Exception handling
Muthukumaran Subramanian
 
PPTX
What is Exception Handling?
Syed Bahadur Shah
 
PPTX
Exception Handling in Java
lalithambiga kamaraj
 
PPTX
Lecture 1 Try Throw Catch.pptx
VishuSaini22
 
PPTX
C++ ala
Megha Patel
 
PPT
Exceptions in C++exception handling in C++, computer programming.ppt
Manwa2500
 
PPTX
Exception handling.pptxnn h
sabarivelan111007
 
PPTX
Exception handling
zindadili
 
PPT
Exceptions in c++
Kuntal Bhowmick
 
PPT
Exception handling
zindadili
 
exception handling
rajshreemuthiah
 
Web technology
Siva Priya
 
22 scheme OOPs with C++ BCS306B_module5.pdf
sindhus795217
 
Exceptions in C++ Object Oriented Programming.pptx
estorebackupr
 
Exception handling
Waqas Abbasi
 
Maheen oop
mahshah212
 
Exceptions and Exception Handling in C++
IRJET Journal
 
F6dc1 session6 c++
Mukund Trivedi
 
Lecture 3.1.1 Try Throw Catch.pptx
sunilsoni446112
 
exception handling in cpp
gourav kottawar
 
Exception handling
Muthukumaran Subramanian
 
What is Exception Handling?
Syed Bahadur Shah
 
Exception Handling in Java
lalithambiga kamaraj
 
Lecture 1 Try Throw Catch.pptx
VishuSaini22
 
C++ ala
Megha Patel
 
Exceptions in C++exception handling in C++, computer programming.ppt
Manwa2500
 
Exception handling.pptxnn h
sabarivelan111007
 
Exception handling
zindadili
 
Exceptions in c++
Kuntal Bhowmick
 
Exception handling
zindadili
 
Ad

More from imran khan (10)

PPTX
Business plan
imran khan
 
PPTX
resistors
imran khan
 
PPT
ohm's law and circuits
imran khan
 
PPTX
Ideology of pakistan
imran khan
 
PPTX
Intelligence
imran khan
 
PPTX
Matrix transapose in c++
imran khan
 
PPTX
limits and continuity
imran khan
 
PPTX
inline function
imran khan
 
PPTX
Data mining
imran khan
 
PPTX
Software Engineering tools
imran khan
 
Business plan
imran khan
 
resistors
imran khan
 
ohm's law and circuits
imran khan
 
Ideology of pakistan
imran khan
 
Intelligence
imran khan
 
Matrix transapose in c++
imran khan
 
limits and continuity
imran khan
 
inline function
imran khan
 
Data mining
imran khan
 
Software Engineering tools
imran khan
 
Ad

Recently uploaded (20)

PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 

Exception handling in c++

  • 1. 1
  • 2. CONTENT : • INTRODUCTION • TRY ,THROW,CATCH • SYNTAX • EXAMPLE 2
  • 3. INTRODUCTION : Exception Handling : It is a way of handling error which occure while executing program. Exception are run time unusual condition that a program may encounter while executing.. This unusual condition includes condition such as “division by zero”,””, or “running out of memory or disk space”. 3
  • 4. CONTIN…. TRY : It is one of the block in which we write the block of statements which causes executions at run time in other words try block always contains problematic statements. 4
  • 5. CONTIN…. THROW BLOCK: 5 A throw expression signals that an exceptional condition—often, an error—has occurred in a try block
  • 6. CONTIN…. CATCH BLOCK: It is one of the block in which we write the block of statements which will generates user friendly error messages in other words catch block will suppose system error messages. 6
  • 7. In an program a block of code which can produce error is placed in try block When an exception is detected in try it is thrown using throw statement Syntax try { throw exception; } catch(type argument) { } SYNTAX 7
  • 8. Relating exception handling with real life If a Smartphone fails the test try throw catch 8
  • 9. PROGRAM #include <iostream> #include <conio.h> using namespace std; Int main() {  int dividend, divisor, quotient;  try  {  cout << " Enter the dividend: ";  cin >> dividend;  cout << "Enter the divisor: "; 9
  • 10. CONTIN…..  cin >> divisor;  if (divisor == 0)  throw divisor;  quotient = dividend / divisor;  cout << "Quotient = " << quotient << endl;  }  catch (int x)  { cout << "Division by "<< x << endl;  } } 10