Password Program Help Please!!!
-
Hello everyone. The following code works perfectly. I would like to expand it so that the program can remember more that just one character as a password/input. #include main() { char pass; system("clear"); printf("\n\nWhat is the password?\n\n"); scanf("%c",&pass); if (pass == 'l') { system("clear"); printf("\n\nVery good.\n\n");} else {system("clear"); printf("\n\nVery bad!\n\n");}
-
Hello everyone. The following code works perfectly. I would like to expand it so that the program can remember more that just one character as a password/input. #include main() { char pass; system("clear"); printf("\n\nWhat is the password?\n\n"); scanf("%c",&pass); if (pass == 'l') { system("clear"); printf("\n\nVery good.\n\n");} else {system("clear"); printf("\n\nVery bad!\n\n");}
Try:
char pass[10];
system("clear");
printf("\n\nWhat is the password?\n\n");
scanf("%s", pass);
if (strcmp(pass, "l") == 0)"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Try:
char pass[10];
system("clear");
printf("\n\nWhat is the password?\n\n");
scanf("%s", pass);
if (strcmp(pass, "l") == 0)"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Thanks.