0

Is there any better solution for this one??? I got only 12/13 correct tests and I can't find why the other test was wrong

I'm not knowledgeable enough so I'm sharing this with you all. It's actually a hard challenge in code coach #include <iostream> #include <string.h> using namespace std; int main() { int ctrN, ctrS; char password[50]; cin>>password; for(int i = 0; i<strlen(password); i++){ if(password[i]=='1'||password[i]=='2'||password[i]=='3'||password[i]=='4'||password[i]=='5'||password[i]=='6'||password[i]=='7'||password[i]=='8'||password[i]=='9'||password[i]=='0'){ ctrN++; } if(password[i]=='!'||password[i]=='@'||password[i]=='#'||password[i]=='

#x27;||password[i]=='%'||password[i]=='&'||password[i]=='*'){ ctrS++; } } if(ctrN < 2 || ctrS < 2 || strlen(password) < 7){ cout<<"Weak"; } else{ cout<<"Strong"; } return 0; }

12th Aug 2020, 12:35 AM
Jayp
Jayp - avatar
1 Answer