
Jaker wrote:Here, this is what my bro has written(source: https://gist.github.com/anonymous/25693 ... 4a781c260e)Thank you and to your brother! I would like to thank everyone who posted here and used their brains, domeone might lock this now.Code: Select all#include <stdio.h> #include <ctype.h> char s[100]; int main() { scanf("%s", s); int has_upper = 0; int has_lower = 0; int has_digit = 0; int has_dollar = 0; for (char *c = s; *c; ++c) { if (isupper(*c)) has_upper = 1; if (islower(*c)) has_lower = 1; if (isdigit(*c)) has_digit = 1; if (*c == '$') has_dollar = 1; } if (strlen(s) <= 20 && has_upper && has_lower && has_digit && has_dollar) puts("Strong"); else puts("Weak"); return 0; }
Shirt wrote:ATGOggy wrote:Go through all the characters of the password and for a character ch,
1) if (ch >= 'A' && ch <= 'Z') then it's a upper case letter
2) if (ch < 'A' || ch > 'Z') then it's a lower case letter
3) if(isdigit(ch)), then it's a digit
4) if(strlen(password)>=20), this checks if the password has atleast 20 characters
5) if(ch=='$')
EDIT: For going through each characters,
char ch;
for(i=0; i<strlen(password); i++)
{
ch=password;
blah blah blah
}
thank you so much for your guidelines, would definitely try out this.
but what I didn't get here is, this part
char ch; \\got it
for(i=0; i<strlen(password); i++) \\the part which I didn't get
{
ch=password
please explain me that 'for' part.
@Auto;
No, it is not any homework, I was just learning C programming through youtube because it cost too much to learn from any IRL teacher. And I saw this question in some forums I suppose and then was not able to do it. So, I thought let's ask you guys.
@Jaker;
Would appreciate your help, mate.

ATGOggy wrote:Shirt wrote:ATGOggy wrote:Go through all the characters of the password and for a character ch,
1) if (ch >= 'A' && ch <= 'Z') then it's a upper case letter
2) if (ch < 'A' || ch > 'Z') then it's a lower case letter
3) if(isdigit(ch)), then it's a digit
4) if(strlen(password)>=20), this checks if the password has atleast 20 characters
5) if(ch=='$')
EDIT: For going through each characters,
char ch;
for(i=0; i<strlen(password); i++)
{
ch=password;
blah blah blah
}
thank you so much for your guidelines, would definitely try out this.
but what I didn't get here is, this part
char ch; \\got it
for(i=0; i<strlen(password); i++) \\the part which I didn't get
{
ch=password
please explain me that 'for' part.
@Auto;
No, it is not any homework, I was just learning C programming through youtube because it cost too much to learn from any IRL teacher. And I saw this question in some forums I suppose and then was not able to do it. So, I thought let's ask you guys.
@Jaker;
Would appreciate your help, mate.
You know how 'for' loops work, right?
I don't know how to explain it xD So I'll give you an example.
Suppose there's a string -
char string[]={'H', 'e', 'l', 'l', 'o', '\0' }
so value of string[0] will be 'H'
string[1] = 'e'
string[2] = 'l'
string[3] = 'l'
strong[4] = 'o'
ATGOggy wrote:Ah i though you were that guy, he used to play back in 2013, he was cute tho :OIDoNotKeyBind wrote:[UC]Agent_Oggy. Right??No, I'm AtgOggy or [Lsrcr]Oggy or Oggy
Users browsing this forum: No registered users and 2 guests