special characters

int main()
{
char name[50];

cout << "please enter your password: ";

cin.getline(name, 50);

cout << "your password is " << name << endl;

return 0;
}

Let's say, I have this program and asked the user to enter the password.
But I want to include at least one of '@', '!', '#', '$' special characters.
And I don't want any other special characters except those four.

How do we do that? Please help.
1. Use std::string.
2. Check each character
3. #include <cctype> and use the functions (like ispunct()) to help.
Topic archived. No new replies allowed.