CPP_Modules
CPP_Modules copied to clipboard
Using forbidden functions?
Hey! I was checking your answers and noticed that you are using stoi, stof and stood in module 06. As explained here, those are C++11 functions.
Did you get an exception from your School or is there a loophole in the rules?
bool Converter::isImpossible( void ) {
try
{
if ( _type == INT ) {
_n = std::stoi( _str );
} else if ( _type == FLOAT ) {
_f = std::stof( _str );
} else if ( _type == DOUBLE ) {
_d = std::stod( _str );
}
}
catch ( std::exception& e )
{
_impossible = true;
return true;
}
return false;
}