Answers for "creating exceptions cpp"

C++
6

c++ throw exception

#include <stdexcept>

int compare( int a, int b ) {
    if ( a < 0 || b < 0 ) {
        throw std::invalid_argument( "received negative value" );
    }
}
Posted by: Guest on May-01-2020
0

cin exceptions c++

cin.exceptions(ios_base::failbit);
Posted by: Guest on October-19-2020

Browse Popular Code Answers by Language