
IDoNotKeyBind wrote:Hello, if anyone of you is into C programming language and knows how to code and stuff. Please give me coding of this question, any help would be appreciated.I have an older brother which is an absolute pro in programming (currently he's doing C++, but he knows C as well. He's won 2 silver and 2 gold medals on World and European Olympiads in Informatics (programming). I'll tell him about your problem and then forward it here or to your PM.
Just for you to know, I use code blocks, to code and compile.
Q. You have to enter a password, and tell that if it is a weak password or strong on the basis of the following:
1. It should contain an uppercase letter.
2. It should contain a lowercase letter.
3. It should contain a digit.
4. It should not be more than 20 characters.
5. It should contain the '$'(dollar) sign.
That's it.
Thank you for your help (even if you don't because reading is pain in the ass when you know nothing about it).
Jaker wrote:Year and for which school?IDoNotKeyBind wrote:Hello, if anyone of you is into C programming language and knows how to code and stuff. Please give me coding of this question, any help would be appreciated.I have an older brother which is an absolute pro in programming (currently he's doing C++, but he knows C as well. He's won 2 silver and 2 gold medals on World and European Olympiads in Informatics (programming). I'll tell him about your problem and then forward it here or to your PM.
Just for you to know, I use code blocks, to code and compile.
Q. You have to enter a password, and tell that if it is a weak password or strong on the basis of the following:
1. It should contain an uppercase letter.
2. It should contain a lowercase letter.
3. It should contain a digit.
4. It should not be more than 20 characters.
5. It should contain the '$'(dollar) sign.
That's it.
Thank you for your help (even if you don't because reading is pain in the ass when you know nothing about it).

Zoroark wrote:I've given people in game moneyHis life is fulfilled now

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
}
#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;
}Users browsing this forum: No registered users and 3 guests