isalpha and ispunct work punctiliously, but isspace spaces out.
cout << "Please enter an integer: ";
cin >> str;
int bogus = 0;
for (int i = 0; i < str.length(); i++)
{
char temp = str.at(i);
if (isalpha(temp) || isspace(temp) || ispunct(temp))
{
cout << "Please try again!" << endl;
cout << "The bad character is " << temp << endl;
bogus++;
break;
}
}
if (bogus < 1)
cout << "Succeeded with " << str << endl;
Rich