otakugirl539 otakugirl539
  • 14-09-2019
  • Computers and Technology
contestada

How can an exception be explicitly raised in C++? How are exceptions bound to handlers in C++?

Respuesta :

flightbath flightbath
  • 19-09-2019

Answer:

Exceptions are raised using throw statement in c++.

Explanation:

Try block is used to keep the statements which we felt that they will raise an exception. Catch block is used to catch the exception which is thrown by the try block.

#include<iostream.h>

void main(){

int x,y,z;

try{

cout<"enter 2 numbers";

cin>>x>>y;

if(y==0)

throw y;

z=x/y;

}

catch(int x){

cout<<"exception caught";

}

}

Answer Link

Otras preguntas

burma is an island located between the pieces of the country of Malaysia
Which internal heat source still generates heat within the terrestrial worlds today?
The energy an object possesses due to its form and position is know as
How did The empaction proclamation affect enslaved people in the south
Which activity helps develop muscular endurance? Going for a walk. Playing tennis. Rowing. Ballet
in simplest form whats the ratio of 18 mins to 1.5 hours
what is the pOH of a 4.8 x 10^-10 M H+ solution?
The height, CE, of the trapezoid is 5 units. What is the area of the trapezoid? AD = units BC = units The area of the trapezoid is square units.
3 5⁄24 + 6 7⁄24 + 4 9⁄24
Need help with some portfolio question 30 point! 3.The mean rounded to the nearest tenth of the following data set is: 15,16,17,23,11,19,20,15,18,22,15,19 4.T