.


:




:

































 

 

 

 





. . , , , . , .

. div() , . , .

#include<iostream>

using namespace std;

double div(double dividend, double divisor)

{ if(divisor==0) throw 1;

return dividend/divisor;

}

int main()

{ double result;

try {

result=div(77.,0.);

cout<<"Answer is "<<result<<endl;

}

catch(int){

cout<<"Division by zero"<<endl;

}

return 0;

}

:

Division by zero

. -, div() , try. , . , try, .

try catch, . , catch-. - , .

throw ( div()). throw , catch. . , .

if(divisor==0) throw 1 1 1., catch ( double).

. , .

add() add_class, - add_class . , unsigned short, .

#include<iostream>

using namespace std;

#include<limits.h>





:


: 2015-09-20; !; : 894 |


:

:

. .
==> ...

1276 - | 1248 -


© 2015-2024 lektsii.org - -

: 0.01 .