I'm working on a problem where I am trying to validate the user input to verify only digits have been used. I'm trying to use the ASCII code to do so, but I'm stuck. I would greatly appreciate any help that can be provided. Thank you in advance!!!
*Delilah*
#include <iostream>
using namespace std;
int main()
{
char number[11];
int x = 0;
cout << "Please enter the phone number: ";
cin >> number;
while (number[x] != '\0')
{
if ((int(number[x]) > 46 || int(number[x]) < 58)
cout << int(number[x]);
x++;
}
else
{
cout << "Invalid characters";
}//end if
system("pause");
return 0;
}