0
What is wrong in my code ?
#include <bits/stdc++.h> using namespace std; int main() { string str; getline(cin,str); int number=0,symbol=0; for(int i=0;i<str.length();i++){ if(str[i]>=0 && str[i]<=9) { number++; } else if(str[i]=='!' || str[i]=='@'||str[i]=='#'||str[i]=='
#x27;||str[i]=='%'||str[i]=='&'||str[i]=='*') { symbol++; } } if(str.length()>6 && number>1 && symbol>1) { cout<<"Strong"; } else{ cout<<"Weak"; } return 0; } https://code.sololearn.com/cXleptRu9kSm/?ref=app3 Answers
+ 3
please use unsigned int instead of int otherwise it will cause warning . Anyway that's not the main problem.
See this:
https://code.sololearn.com/coEqeROn4GCz/?ref=app
+ 4
As you checked if there are symbols in the inputing string you have to check if there are number too.If not output will be always Weak.
+ 1
Samsil Arefeen yeah now its done ,thanks mate