If the string was "0983" I want it to be true but if it was "124Test" I want it to remain false.
Saying that, an approach would be checking if a character is not a number, then return false, instead of checking every character until the end of the string.
bool b = true;
for(int i = 0; i < string.size(); i++)
{
if(string.at(i) < '0' || string.at(i) > '9')
{
b = false;
break;
}
}