본문 바로가기
C++

[HackerRank] Exceptional Server - Easy

by 호아나트 2019. 10. 25.
반응형

https://www.hackerrank.com/challenges/exceptional-server/problem

 

Exceptional Server | HackerRank

Handle server errors.

www.hackerrank.com

 

		/* Enter your code here. */
        try{
            cout<<Server::compute(A, B)<<endl;
        }
        catch(bad_alloc& badAlloc)
        {
            cout<<"Not enough memory"<<endl;
        }
        catch(exception& except)
        {
            cout<<"Exception: "<<except.what()<<endl;
        }
        catch(...)
        {
            cout<<"Other Exception"<<endl;
        }
반응형

'C++' 카테고리의 다른 글

[HackerRank]Vector-Sort - Easy  (0) 2019.10.29
[HackerRank] Virtual Functions -Medium  (0) 2019.10.28
[HackerRank] Inherited Code - Easy  (0) 2019.10.25
[HackerRank] Box it! - easy  (0) 2019.10.23
[HackerRank] Classes and Objects - Easy  (0) 2019.10.16

댓글