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=app

17th Sep 2020, 1:39 PM
AB💞
AB💞 - avatar
3 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
17th Sep 2020, 2:24 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 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.
17th Sep 2020, 2:07 PM
HBhZ_C
HBhZ_C - avatar
+ 1
Samsil Arefeen yeah now its done ,thanks mate
17th Sep 2020, 2:29 PM
AB💞
AB💞 - avatar