I'm making a basic text adventure and am wondering if this code i've made is the best way to check if a string is an integer and then convert it if is or not if it isn't?
1 2 3 4 5 6 7
try{
int_input = stoi(string_input);
number = true;
}
catch (invalid_argument){
number = false;
}