Anybody have any idea how am i going to add strcmp into here??
char username[100][31], password[100][31],usercheck[31],passcheck[31];
int count=0, index=0;
int option;
char Y='y';
int N;
printf("======Password auto-generation and validation ====== \n");
do
{
printf("1)Create the user account< username+password> \n");
printf("2)Validation of login ID and password \n");
printf("3)Password auto-generation. \n");
printf("4)Exit \n");
printf("============================================================ \n");
printf("Enter your option: \n");
flushall();
scanf("%d" , &option);
if(option==1)
{
printf("Please type in user ID: \n");
flushall();
gets(username[index]);
printf("Please type in your password: \n");
gets(password[index]);
do
{
printf("Do u want to create more user?(Y/N) \n");
scanf("%c" , &Y);
if(Y=='y')
{
index++;
printf("Enter a username for user[%d]: \n",index+1);
flushall();
scanf("%s",username[index]);
printf("Please enter a password: \n");
flushall();
gets(password[index]);
}
}while(Y=='y');
}
if(option==2)
{
count=0;
do
{
index++;
printf("Enter your user name:");
flushall();
gets(usercheck);
do
{
if(username[index]==usercheck)
{
printf("Enter the password\n");
gets(passcheck);
}
else
{
index++;
if(index>100)
printf("Invalid username. Please enter again\n");
}
}while(usercheck!=username[index] && index<=100);
}while(index>100);
if(passcheck==password[index])
{
printf("Password check: Pass\n");
}
else
{
do
{
printf("Password is not VALID, you may try again.");
printf("Enter the password\n");
gets(passcheck);
count++;
}while(count<3 && passcheck!=password[index]);
if(count==3)
printf("You have tried 3 times already, no more attempts are allowed!");
if(passcheck==password[index])
printf("Password check: Pass\n");
}
}
}while(option != 4);
}