int main()
{
int count = 0;
string str; // declaring variable
cout << "enter a string "<< endl; // prompting user
getline(cin,str); // geting line
int size = str.length();
for(int i=0;i<size;i++)
{
if (str[i]<'0' || str[i]>'9')
{
cout <<str<< " is not a number " << endl;
break;
}
if(i == size-1)
{
cout<<str<<" is a number "<<endl;
}
count++;
}
return 0;
}
/*
enter a string
43w 23r 231
43w 23r 231 is not a number
*/
// it should be 43w is not a number endl. 23r is not a number endl. 231 is a number endl;