Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- using namespace std;
- double division(int a, int b)
- {
- if( b == 0 )
- {
- throw string("Division by zero condition!");
- }
- if(b==2)
- throw 0;
- return (a/b);
- }
- int main(){
- int a=10, b=3;
- try{
- cout<<division(a, b);
- } catch(string s){
- cout<<"Error:: "<<s;
- }
- catch(int flag){
- cout<<"Error_Code:: "<<flag;
- }
- cout<<"\n\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement