In this blog, I’m explaining about Exception handling in C++
An exception is a problem that arises during the execution of a program Exceptions provide a way to transfer control from one part of a program to another.
C++ exception handling is built upon three keywords: _try, catch and throw.
throw: A program throws an exception when a program show up. This is done using a throw keyword.
try: A try block identifies a block of a code for which particular exceptions will be activated. It’s followed by one or more catch blocks.
catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. This is done using a catch keyword.
// Exception.cpp : main project file.
using namespace std;
using namespace System;
int main(array<System::String ^> ^args)
cout<<"Enter first number";
cout<<"Enter second number";