cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
special characters
special characters
Feb 10, 2018 at 4:39pm UTC
flamminghot
(5)
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.
Feb 10, 2018 at 4:43pm UTC
Duthomhas
(13201)
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.