when someone types in a name with only alphabetic characters it outputs valid name for how long the name is. For Ex: bob is three characters so it would output valid name three times. also when you put in a name with a number or character at the end it outputs valid name for the correct characters but also outputs the invalid character and invalid name which its supposed to do. the valid name should not be showing up though.
bool isValidName = true;
for (int x = 0; x < strlen(name); x++)
{
if (!isalpha(name[x])) // You can also use isalpha in <cctype>, by the way
{
isValidName = false;
cout << "Your name cannot contain: " << /* etc. */;
// ...
}
}
if (isValidName)
cout << "Valid name.";
// ...