+ 2

Runtime_error program

How could I make a program that implements runtime_error? I’m confused as to how to make one that the constructor takes in a input string and displays it.

26th May 2019, 9:49 PM
Charlie
Charlie  - avatar
5 Respuestas
+ 1
If I understand what you’re asking correctly, the answer is in the C++ tutorial under exceptions. Handle exceptions using the keywords try, throw, and catch
26th May 2019, 10:04 PM
Pete Cowling
Pete Cowling - avatar
+ 1
it doesnt mention runtime error in it
26th May 2019, 10:10 PM
Charlie
Charlie  - avatar
+ 1
https://www.sololearn.com/discuss/558877/?ref=app You can use exception handling for runtime errors, such as dividing by zero
26th May 2019, 10:19 PM
Pete Cowling
Pete Cowling - avatar
+ 1
so i could use this in main to do a try, catch, throw for say, division? https://code.sololearn.com/cTdtt8U8j5nw/?ref=app
26th May 2019, 10:30 PM
Charlie
Charlie  - avatar
+ 1
I’m not proficient in C or C++, but from what I can read, it might work. The only way to know for sure is to test it out though
26th May 2019, 11:25 PM
Pete Cowling
Pete Cowling - avatar