We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Classes
- Exceptional Server
- Discussions
Exceptional Server
Exceptional Server
+ 0 comments try { int result = Server::compute(A, B); cout << result << '\n'; } catch (const std::bad_alloc &e) { cout << "Not enough memory" << '\n'; } catch (const exception &e) { cout << "Exception: " << e.what() << '\n'; } catch (...) { cout << "Other Exception" << '\n'; }
+ 0 comments If you could'nt able to solve this problem then you should try this solution. Probably this could work-
 << endl; } catch(bad_alloc& error){ cout << "Not enough memory" << endl; } catch(exception& error){ cout << "Exception: " << error.what() << endl; } catch(...){https://) cout << "Other Exception" << endl; }
+ 0 comments try { int res = Server::compute(A, B); cout << res << endl; } catch (std::invalid_argument const& ex){cout << "Exception: " << ex.what() << endl;} catch (std::bad_alloc const& ex){cout << "Not enough memory" << endl;} catch (std::exception const& e){cout << "Exception: " << e.what() << endl;} catch(...){cout << "Other Exception" << endl;}
+ 2 comments 9/10 test cases failed because I did not use "endl" in the "Try" - when printing out the actual function result.
+ 0 comments Here are the solution of HackerRank Exceptional Server in C++ Solution
Join Telegram Group for Updates Click Here
Load more conversations
Sort 155 Discussions, By:
Please Login in order to post a comment