Write a program using a 2-D array to store a user name and password(both strings
ID: 3615444 • Letter: W
Question
Write a program using a 2-D array to store a user name and password(both strings) that will ask the user for his/her user name andthen test to see if they are a valid user, if they are a valid userthen the program should ask the user for their password. If theyare not a valid user the program should allow the user to make atotal 3 attempts to enter a valid user-name. If the user does notenter a valid user-name the program should exit after they haveextinguished their 3 attempts and print an error indicating why theuser was kicked out. If the user has enter a valid user-name theprogram should check to see if the password they entered is valid,if it is then print a welcome user screen if not allow the user toretry their password 2 more times ( a total of 3 tries). If after 3attempts at the password the program should exit and print an errorindicating why the user was kicked out.Explanation / Answer
please rate - thanks #include #include #include int main() {char pw[20][2][8]; char name[8],word[8]; int i=0,yes=0,j,found=0,count; FILE *input; input = fopen("passwords.txt","r"); if(input == NULL) { printf("Error opening input file! "); getch(); return 0; } while(fscanf(input,"%s",&pw[i][0][0])!=EOF) {fscanf(input,"%s",&pw[i][1][0]); i++; } fclose(input); count=i; j=0; yes=0; do{ printf("Enter username: "); scanf("%s",&name); 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.