Please help guys... Arrays ..... I have noidea how to write this program. I need
ID: 3615650 • Letter: P
Question
Please help guys... Arrays ..... I have noidea how to write this program. I need to write a program in C thatwill ask the following 3 users to enter both their username andpassword:userid password
CMoorey apples
JBicker bluesy
BChurch visits
If the username is correct, the user will then be prompted to enterhis/her password.
If the username is incorrect, the user will get a print screen thatsays "Invalid username, please try again." The user will beprompted to reenter their username a second time. If the passwordis incorrect, they will get another print screeen that will say"UnKnown User. GOODBYE!" and the program will close.
If the password is correct, the user will get a print screen thatsays "WELCOME!"
If the password is incorrect, the user will get a print screen thatsays "ERROR, INCORRECT PASSWORD. PLEASE TRY AGAIN!" The user willthen be prompted to reenter their password a second time. If thepassword is incorrect, they will get another print screeen thatwill say "INCORRECT PASSWORD. GOODBYE!" and the program willclose.
Please help. I have to submit this tonight. Below is my code it'snot working properly.
THANKS
#include <stdio.h>
#include<string.h>
int main()
{char user[3][8]={"CMoorey","JBicker","BChurch…
char pw[3][8]={"apples","bluesy","visits"};
char word[8];
int i=0,yes=0,j ;
for(i=0;i<3;i++)
{j=0;
yes=0;
do{
printf("Enter your username==> ");
scanf("%s",&user);
if(strcmp(word,user[i])==0)
yes=1;
j++;
if(yes==0&&j!=3)
printf("ERROR, INCORRECT USERNAME. PLEASE TRY AGAIN! ");
}while(j<3&&yes==0);
if(yes==0)
printf("INCORRECT USERNAME. GOODBYE! ");
else
printf ("Hello %s. Enter password: ", user[i]);
scanf("%s",&word);
if(strcmp(word,pw[i])==0)
yes=1;
j++;
if(yes==0&&j!=3)
printf("ERROR, INCORRECT PASSWORD. PLEASE TRY AGAIN! ");
}while(j<3&&yes==0);
if(yes==0)
printf("INCORRECT PASSWORD. GOODBYE! ");
else
printf("WELCOME! ");
return 0;
} Please help guys... Arrays ..... I have noidea how to write this program. I need to write a program in C thatwill ask the following 3 users to enter both their username andpassword:
userid password
CMoorey apples
JBicker bluesy
BChurch visits
If the username is correct, the user will then be prompted to enterhis/her password.
If the username is incorrect, the user will get a print screen thatsays "Invalid username, please try again." The user will beprompted to reenter their username a second time. If the passwordis incorrect, they will get another print screeen that will say"UnKnown User. GOODBYE!" and the program will close.
If the password is correct, the user will get a print screen thatsays "WELCOME!"
If the password is incorrect, the user will get a print screen thatsays "ERROR, INCORRECT PASSWORD. PLEASE TRY AGAIN!" The user willthen be prompted to reenter their password a second time. If thepassword is incorrect, they will get another print screeen thatwill say "INCORRECT PASSWORD. GOODBYE!" and the program willclose.
Please help. I have to submit this tonight. Below is my code it'snot working properly.
THANKS
#include <stdio.h>
#include<string.h>
int main()
{char user[3][8]={"CMoorey","JBicker","BChurch…
char pw[3][8]={"apples","bluesy","visits"};
char word[8];
int i=0,yes=0,j ;
for(i=0;i<3;i++)
{j=0;
yes=0;
do{
printf("Enter your username==> ");
scanf("%s",&user);
if(strcmp(word,user[i])==0)
yes=1;
j++;
if(yes==0&&j!=3)
printf("ERROR, INCORRECT USERNAME. PLEASE TRY AGAIN! ");
}while(j<3&&yes==0);
if(yes==0)
printf("INCORRECT USERNAME. GOODBYE! ");
else
printf ("Hello %s. Enter password: ", user[i]);
scanf("%s",&word);
if(strcmp(word,pw[i])==0)
yes=1;
j++;
if(yes==0&&j!=3)
printf("ERROR, INCORRECT PASSWORD. PLEASE TRY AGAIN! ");
}while(j<3&&yes==0);
if(yes==0)
printf("INCORRECT PASSWORD. GOODBYE! ");
else
printf("WELCOME! ");
return 0;
}
Explanation / Answer
please rate - thanks I wrote the original code #include #include #include int validate(char[8],char[]); int main() {char user[3][8]={"CRobert","JMoorey","BChance"}; char pw[3][8]={"spear","bluey","visor"}; int i=0,yes=0,j; for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.