31 lines
511 B
C++
31 lines
511 B
C++
/*
|
|
An exception is an exceptional circumstance
|
|
that arises at runtime
|
|
|
|
try => run code in protected env.
|
|
catch => catch an exception.
|
|
throw => thrown an exception
|
|
|
|
|
|
int x,y; // if y = 0
|
|
cin >> x >> y;
|
|
cout << x/y << endl;
|
|
|
|
//string to integer
|
|
string s = "10"
|
|
sstream = str(s);
|
|
int a;
|
|
if(str >> a){
|
|
//success
|
|
}else{
|
|
//failure
|
|
}
|
|
|
|
|
|
cpp refrecnce
|
|
cpp::out of range
|
|
|
|
we can create our own exception
|
|
//what//is virtual
|
|
|
|
*/ |