0

but now when i generate a password it has weird characters in it

Because there are unused bytes in the array that contain random junk characters. Initialize the whole array with 0s before doing anything.

char password[5 + 5 + 5 + 5 + 1] = {0}; // 4 Upper, 4 Lower, 2 Num, 2 Symbols

0

anyone please write a program to enter password that should be 6 alphabet, 3 digit, 1 special character and it should be in sequence in c

0

Random with modulo:

#include <stdio.h>
#include <time.h>
int main(void) 
{
int i;
char c;

srand(time(NULL));

printf("Ihre Passwort ist: ");

for (i=0;i<10;)
    {
    if(i%3==0)
    {       
    c='A'+rand()%('Z'-'A'+1);
    }
    else if(i%2==0)
    {
    c='1'+rand()%('9'-'1'+1);
    }
    else
    {       
    c='a'+rand()%('z'-'a'+1);
    }  
    printf("%c", c);
    i++;
    }

getch();    
return 0;
}
-1

hi guys, I'm new to c. my task is to write a program in c for
Louise joined a social networking site to stay in touch with her friends. The signup page required her to input a name and a password. However, the password must be strong. The website considers a password to be strong if it satisfies the following criteria:

Its length is at least .
It contains at least one digit.
It contains at least one lowercase English character.
It contains at least one uppercase English character.
It contains at least one special character. The special characters are: !@#$%^&*()-+
She typed a random string of length in the password field but wasn't sure if it was strong. Given the string she typed, can you find the minimum number of characters she must add to make her password strong?

0

Please do not reanimate old threads, even if you are asking a question similar to the existing one. If you have a new question, start a new thread.

I recommend reading the forum Posting Rules, Terms of Service and Advice on Asking Questions before proceeding here. Specifically those pertaining to asking for help on things like employment tests, homework, and, as in this case, online coding challenges. This one in particular seems relevant:

Do provide evidence of having done some work yourself if posting questions from school or work assignments

As a word of warning: I was readily able to find out where this problem is from with basic searches on Google and DuckDuckGo. If I can find that, then the people running that website can find this thread, too.

Oh, and the fact that the Google search also brought up at least one solution doesn't exactly reflect well on your ability to research a problem, either.

Edited by Schol-R-LEA

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.