I am working on a small c++ program and learning exceptions. Is the following code \"bad\", and if so, what can I do to improve it?
try { // code if
I think this is much more simpler. :).
#include #include using namespace std; int main() { try { throw runtime_error("This is an Error"); }catch (exception& e){ cout << "Exception: " << e.what() << endl; } return 0; }