traverse a string to look for certain chars
Hey people I am trying to do a validation type thing for the names of people. I prompt for the name and then validate it. I am using getline to store the string because some names contain spaces. i would like to check the string to make sure there are no unwanted chars like "@" and "," etc. so far i can traverse a string to find 1 character using name.find() i will paste the code below, but i cant seem to get that to find more than one char. how do i fix it?
int main ()
int i = 0;
int dot_appearances = 0;
getline(cin, name, '\n');
for(i = name.find(".", 0); i != string::npos; i = name.find(".", i))
cout << dot_appearances;