I\'ve had quite a bit of trouble trying to write a function that checks if a string is a number. For a game I am writing I just need to check if a line from the file I am r
Try this:
bool checkDigit(string str) { int n=str.length(); for(int i=0; i < n ; i++) { if(str[i]<'0' || str[i]>'9') return false; } return true; }