hello i'm trying to figure out how to write a program in c++ that check when i insert a password and force me to add at least 2 capital letters and 2 numbers in the password (you've seen this before right? when signing up for new account and checks for password stringth)
otherwise won't accept it and gives the output "password not accepted"
anyone can write a simple code for that?
Ahmed91za 0 Newbie Poster
Recommended Answers
Jump to PostWell if you store the password as a
std::string
then you can iterate over each character and check if it is upper or lower case with
Jump to Post@NathanOliver: You're correct, it doesn't compile. In this case the compilation failure is because
std::isupper
takes a locale as well as the character to test. Using the C functionisupper
does compile though (and does the right thing):#include <iostream> #include <string> #include <algorithm> #include …
All 7 Replies
NathanOliver 429 Veteran Poster Featured Poster
Ahmed91za 0 Newbie Poster
NathanOliver 429 Veteran Poster Featured Poster
Ahmed91za commented: thanks +0
richieking 44 Master Poster
ravenous 266 Posting Pro in Training
NathanOliver 429 Veteran Poster Featured Poster
ravenous 266 Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.