Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts
Amazon Auto Links: No products found.
guys, i’ve written this, but it doesnot work, please help:
#include
#include
#include
#include
//Boi
#include
#include
#include
int main()
{
char password[20];
char character;
char num_of_digits;
char num_of_uppercase;
char num_of_dollar;
printf(“Password checker v1.0n”);
printf(“Enter password: n”);
scanf(” %s”,password);
for(int i=0; i
Here a quick version for the challenge, if you have any tips to make it better feel free to comment
#include
#include
#include
//Contains boolean data type
#include
int main()
{
int length;
bool upper;
bool lower;
bool number;
printf(“How long shall your password be? n”);
scanf(” %d”, &length);
char password[length];
printf(“Enter a password: n”);
scanf(” %s”, &password);
for(int i = 0; i < length; i++){ if(isupper(password[i]) && !upper) upper = true; if(isdigit(password[i]) && !number) number = true; if(islower(password[i]) && !lower) lower = true; } if(upper && lower && number) printf("You have entered a strong password."); else printf("You have entered a weak password."); return 0; }
here is my piece of code for this challenge.I may have used some features which were not taught here but i think my code is good
#include
#include
#include
Hi guys, I am currently working on the Challenge, but somewhere a bug flew in…. my “low”-value varies depending on how long the password is. value “low” counts the lower case letters, “up” the upper case ones. Can you please help me? I don’t know where to look anymore…
Thank you guys!!!!
#include
#include
#include
#include
#include
It was not as simple as the first exercise and it was mostly difficult to define the length of the loop along the password but with the help of the clips and comments I was able to. More or less, my solution:
#include
#include
#include
#include
int main()
{
int i = 0;int a =0 ; int b = 0; int c =0;int pasL = 0;
char pas[50];
printf(“print password n it must have a symbol a uppercase later and a number. n “);
scanf( ” %s”, pas);
pasL = strlen(pas);
printf(” t t %d”, pasL);
for (i=0; i < pasL; i++ ){ printf("n %d t %dn",c+b+a, i); if(isalpha(pas[i])){ if(isupper(pas[i])){ a = 1; printf("tt #1"); i +=i; continue; }else{ printf("tt #L"); continue;}} if(isdigit(pas[i])){ b = 2; printf("tt #2"); continue; } if(isdigit(pas[i]) || isupper(pas[i]) || pas[i] == ""){ printf("tt #d s"); continue; } else if(c==0){ c = 3; printf("tt #%d ",c); continue; } } if(a*b*c == 6){ printf("n that work"); }else{ printf("n not good"); } return 0; }
As simple possible…
#include
#include
#include
#include
Here’s mine. I have a lot of experience with Python and a lot of peripheral knowledge of C concepts from trying to read source code, so there’s some more advanced concepts:
#include
#include
#include
int main()
{
printf(“Enter your password. Must contain one uppercase letter, one lowercase, one digit, and one special character, like !@#$%^&* (excuse my language)n”);
printf(“Keep it 20 characters or under cause I’m a bad programmer:n”);
// 0 is false, anything else is true
while(1){
char input[21];
scanf(” %s”, input);
// this technique is known as a bit field. Each bit of the number reprents a conditon. If that bit is 0, the condition is false, otherwise it’s true.
// using a char instead of int because we don’t have more than 8 conditions (char is 8-bits, int is 64, might as well not waste space)
char conditions = 0;
// i is the index in the string. If input[i] is 0 (the null character) then we’ve reached the end of the string so stop there.
// Also stop if we’ve already met all the necessary conditions (1 | 2 | 4 | 8 == 15)
for(int i=0; (input[i] != 0) && (conditions != 15); i++){
if(isalpha(input[i])){
// If there’s only one line you don’t need braces. I come from python so I hate the braces.
if(isupper(input[i]))
// this is a bitwise OR.
conditions |= 1;
else
conditions |= 2;
}else if(isdigit(input[i]))
conditions |= 4;
else
conditions |= 8;
}
if(conditions != 15)
printf(“Your password sucks. Try again:n”);
else
break;
}
}
#include
#include
#include
int main()
{
char num[20];
int i,upper=0,lower=0,integer=0,s_c=0;
printf(“please give me your password(up to 19 character)n”);
scanf(“%s”,num);
for(i=0;i<19;++i)
{
if (num[i]==' ')
{
break;
}
if(isalpha(num[i]))
{
if(isupper(num[i]))
{
upper++;
}
else
{
lower++;
}
}
else if(isdigit(num[i]))
{
integer++;
}
else if(num[i]!=' ')
{
s_c++;
}
else
{
}
printf("%c",num[i]);
}
printf("n");
if(upper>0&&lower>0&&integer>0&&s_c>0)
{
printf(“right password! %d upper character%s %d lower character%s %d integer%s %d special character%s)”,upper,(upper==1)?””:”s”,lower,(lower==1)?””:”s”,integer,(integer==1)?””:”s”,s_c,(s_c==1)?””:”s”);
}
else
{
printf(“please retype your password (your password must contain at least 1 uppercase and 1 lower case alphaphet and 1 integer and 1 special character “);
}
return 0;
}
#include
#include
#include
#include
int main()
{
char password[11];
int a,b,c,i = -1;
printf(“please enter your passwordn”);
scanf(” %s”,password);
do{
i++;
}while(password[i]!=’