Question: This is part of a C code. I have a problem with a loop in my code. Please help me to fix this part of

This is part of a C code. I have a problem with a loop in my code. Please help me to fix this part of the code so that the output will be as in the first picture. Now the loop is ending earlier than i need to.

You don't have to fix my code, I just need to find out where the error is and how can I fix it.

This is part of a C code. I have a problem witha loop in my code. Please help me to fix this partof the code so that the output will be as in thefirst picture. Now the loop is ending earlier than i need to.You

Selection: 2 ERROR: Value must be between 0 and 1 inclusive: 0 Are you sure you want to exit? ( [Y]es | [Njo) : n Account Ticketing System - Login 1) Login to the system 0) Exit application Selection: 1 Enter the account#: 30004 User Login : agentJ Password TT* &21tt INVALID user login/password combination! [attempts remaining: 2] Enter the account#: 50008 User Login userMayEnterAVeryLongLogonName Password : TT* &21tt Script done, file is output. txt Checking output : In line number 40 of your output: The output should be: INVALID user login/password combination! [attempts remaining: 1] A But your output is:Selection: 1 Enter the account#: 30004 User Login : agentJ SDDS School of Software Design and Data Science SDDS Fall - 2021 Password : TT*&21tt INVALID user login/password combination! [attempts remaining : 2] Enter the account#: 50008 User Login . . userMayEnterAVeryLongLogonName Password TT*&21tt INVALID user login/password combination! [attempts remaining: 1] Enter the account#: 50008 User Login .. agentJ Password : userMayEnterAVeryLongPasswordValue INVALID user login/password combination! [attempts remaining: 0] ERROR: Access Denied.int menulogin (const struct Account account , int arraynum) { char answer, trylog[11], trypass[9]; int option, accountnum = 0, indexnum = -2, attempts = 3; printf ("======== ====== \ Account Ticketing System - Login\ =========== ======== \ 1) Login to the s printf("0) Exit application\ - -- - - - --\ \ Selection: "); option = getIntFromRange(0, 1); if (option = = 0) printf("\ Are you sure you want to exit? ([Y]es | [Njo) : "); answer = getCharOption("yYnN" ) ; if (answer == 'y' | | answer == 'Y' ) indexnum = -1; else printf ("\ "); else if (option == 1) for (attempts = 2; attempts >= 0; attempts- -) // Login attemts printf("\ Enter the account#: "); accountnum = getInteger ( ) ; indexnum = findAccountIndexByAcctNum(accountnum, account, arraynum, 0) ; printf ("User Login : ") ; getCString(trylog, 1, 30); printf( "Password ") ; getCString(trypass, 1, 30); if (indexnum == -1 | | stromp(trylog, account [indexnum] . userloginfo. loginn) != 0 | stromp(trypass, account [indexnum] . userloginfo. password) != 0) printf("INVALID user login/password combination! [attempts remaining:%%d]\ ", attempts); indexnum = -2; } else attempts -= 3; Activate Winelse if (option == 1) { for (attempts = 2; attempts >= 0; attempts--) // Login attemts printf("\ Enter the account#: "); accountnum = getInteger( ) ; indexnum = findAccountIndexByAcctNum(accountnum, account, arraynum, 0) ; printf("User Login : "); getCString(trylog, 1, 30); printf ( "Password : "); getCString (trypass, 1, 30); if (indexnum == -1 | | stremp(trylog, account [indexnum] . userloginfo. loginn) != 0 | stromp(trypass, account [indexnum] . userloginfo. password) != 0) printf("INVALID user login/password combination! [attempts remaining: %%d]\ ", attempts); indexnum = -2; else attempts -= 3; w - - - if (indexnum == -2) printf("\ ERROR: Login failed! \ \ "); pauseExecution ( ) ; LP return indexnum

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!