Problem with password validation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Problem with password validation

#7 doesn't pass https://code.sololearn.com/c4m4PWq4px2C/?ref=app

6th Dec 2020, 6:27 AM
Alex
Alex - avatar
2 Answers
+ 4
Maybe the reason is , you just declared int count1, count2; So it takes a garbage value of count1 and count2. That's why if the input is: @#rtyui your code says it's strong though it's invalid as there is no number. Just write: int count1=0,count2=0 and another problem maybe: Your line should be : vector<char> dic2 = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; not, vector<int> dic2 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; (I maybe wrong as I don't know the use of vector). https://code.sololearn.com/c9vDxu8mEh9h/#cpp
6th Dec 2020, 6:45 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
thx, it works
7th Dec 2020, 2:37 AM
Alex
Alex - avatar