- 2

Exception C++

Fill in the missing part to catch every kind of exception in the catch block. try { // ...some code } catch ( ) { }

19th Jul 2019, 10:13 PM
Sounak dey
Sounak dey - avatar
5 Respostas
+ 6
...
23rd Feb 2021, 7:13 AM
changa Hettiarachchi
changa Hettiarachchi - avatar
+ 3
try{ // ... } catch (...) { // ... }
22nd May 2020, 4:04 AM
LANKA ATRI DATTA RAVI TEZ
LANKA ATRI DATTA RAVI TEZ - avatar
+ 2
Answer is ... Just type ...
20th Nov 2020, 3:33 AM
Jason Chew
Jason Chew - avatar
+ 1
...
19th Jul 2019, 10:14 PM
Sounak dey
Sounak dey - avatar
0
Here is an example of the code form the exeption challenge put in use: #include <iostream> using namespace std; int main() { string name; cin >> name; try { if (size(name)<4 || size(name)>20) { //cout << "Invalid"; throw 99; } if (!(size(name)<4 || size(name)>20)) { cout <<"Valid"<<endl; } else {cout <<""<<endl; } } //we must specify the data type of the exeption when we throw it catch(int x) { cout << "Invalid"; } return 0; }
24th Jul 2021, 7:46 AM
Hugh Signoriello
Hugh Signoriello - avatar