What did I do wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What did I do wrong?

At the password validation challenge i fail only the 8 case and i don t know why Here s the code #include <iostream> #include <string> #include <algorithm> #include <array> using namespace std; int main() { string str; cin>>str; char numbers[] = {'0', '1', '2', '3', '4', '5' , '6', '7', '8', '9'}; char specials[] = {'!', '@', '#', '

#x27;, '%', '&' , '*'}; bool foundn; bool founds; int length = str.length(); size_t foundn1 = str.find_first_of(numbers); if(foundn1 != string::npos) { str.erase(foundn1, 1); } size_t foundn2 = str.find_first_of(numbers); if(foundn2 != string::npos) { foundn = true; } size_t founds1 = str.find_first_of(specials); if(founds1 != string::npos) { str.erase(founds1, 1); } size_t founds2 = str.find_first_of(specials); if(founds2 != string::npos) { founds = true; } if(foundn == true && founds == true && length > 6) { cout<<"Strong"; } else {cout<<"Weak"}

2nd Mar 2020, 5:08 PM
BlackGuy
BlackGuy - avatar
2 Answers
0
It s not that, i ve putted it in the source code, here i got no space left I got 12 correct cases but one of them is not
2nd Mar 2020, 8:16 PM
BlackGuy
BlackGuy - avatar
- 2
its because you forgot to eat a sandwich
4th Mar 2020, 11:44 AM
JACOB GOLDSMITH
JACOB GOLDSMITH - avatar