+ 11

Can anyone explain this code with the output?

https://www.sololearn.com/post/61159/?ref=app

22nd Jan 2019, 4:36 AM
Aryan
Aryan - avatar
6 Respostas
+ 7
Anyone explain this code plz!
22nd Jan 2019, 6:45 AM
Aryan
Aryan - avatar
+ 4
It's ok Niloufar.Km
2nd Jul 2020, 8:04 AM
Aryan
Aryan - avatar
+ 4
Niloufar.Km ping me when it is possible
2nd Jul 2020, 8:07 AM
Aryan
Aryan - avatar
+ 2
That is a "try block" used to catch runtime errors and exceptions. When an error occurs it might return an exception number. if its exception number 3 or 4, then that value would be passed to catch like a normal method, take the place of x, and then execute the block as written. in this case it would print itself to the console. If no runtime error occurs then this is all skipped and the code continues. http://www.cplusplus.com/doc/tutorial/exceptions/
22nd Jan 2019, 12:58 PM
JPressley
JPressley - avatar
+ 1
For iOS/Web users: Language: C++ What is the output of this code? try { throw 3; throw 4; } catch(int x) { cout << x; }
22nd Jan 2019, 6:44 AM
Diego
Diego - avatar
0
link is broken. goes to a "page not found" page. maybe the code reference was removed?
22nd Jan 2019, 5:30 AM
JPressley
JPressley - avatar