0

What is the the 7th test i passed all except 7th in password validation

Password validation https://code.sololearn.com/cSRc1au1894B/?ref=app

2/3/2020 11:34:51 AM

Samarendra Singh

7 Answers

New Answer

+2

You need to understand something basic. pass is an array of char, so if you want to compare each char you do like this if (pass[i] == '1' || pass[i] == '2' .....

+1

What are you doing here? if(pass[i]==1||2||3||4||5||6||7||8||9||0) This is not the way to check if the char is equal to one of 0 to 9 use inbuilt function if (isdigit(pass[i]) { // your code }

+1

Better use isdigit for clean code.

+1

Thanks i should remember that i comparing char array to number.

0

~ swim ~ i try with if(pass[i]==1||pass[i]==2||pass[i]==4....) But again it show error

0

And 8 know that is wrong way but not getting the right way so i go through that..

0

I try with if (pass[i]==0) Num++; Else if (pass[i]==1) Num++; ... ... Else if(pass[i]==9) Num++; It also shows error ..