Finding spaces and digits

This is only part of my code but I need to check the input of inPin and make sure the user only inputs digits (integers) and if he doesn't then I give an invalid message. I need to do the same with spaces (blanks) in the 2 string inputs but that's not as important as making sure there are no non digits inputted into inPin. So how do I go about checking the input for digits and spaces?

1
2
3
4
5
6
7
8
9
string inUserID, inPassword;
int inPIN;

cout << "Please enter UserID: ";
cin >> inUserID;     //make sure user doesn't include blanks
cout << "Please enter Password: ";
cin >> inPassword;
cout << "Please enter PIN: ";
cin >> inPIN;	     //make sure user inputs only integers before preceding 
look at <cctype>
Topic archived. No new replies allowed.