TRY AND CATCH BLOCK WITH THE NUMBER
#include<iostream> using namespace std; int main() { int a,b; cout<<"enter two numbers"<<"\n"; cin>>a; cin>>b; try { if(b==0 or b==2) throw 0; cout<<a/b<<"\n"; cout<<"success"; } catch(int i) { cout<<"error occured"<<i; } }
Comments
Post a Comment