My C program admin option is not working. Please help me fix it and let the function admin2 run after the correct password and explain what's wrong. ----------- #include #include #include #include #include void admin() {         char pass[21];         int loop = 1;         int in = 1;         int pass1;             system("cls");         for(loop = 1; loop<=in;) {         printf("Enter Password: ");         scanf("char",&pass [21]);         pass1 = strcmp(pass, "admin");         if (pass1 == 0)         {             system("cls");             in = 0;             printf("Password Confirm !!");         admin();         } else {             system("cls");             in = 1;             printf("Access Denied !!");         }         } } void admin2() {         int i,w;         int item_code[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};         int item_code2;         printf("Welcome: Admin --");         printf("MENU");                 printf("What would you like to order:-  ");             printf("Food/Price");             printf("\n [1]Big Breakfast/P249 ");             printf("\n [2]Daing naBangus/P130");             printf("\n [3]Beef Steak/P120");             printf("\n [4]Longanisa/P100");             printf("\n [5]Pork Tocino/P110");             printf("\n [6]Tapa/P120");             printf("\n [7]Roast Chicken/P130");             printf("\n [8]Sharkfin/P170");             printf("\n [9]Bangus Sisig/P130");             printf("\n [10]Serbesa Pork Chop/P120");             printf("\n [11]Calamari/P180");             printf("\n [12]Arroz Caldo/P99");             printf("\n [13]Fried Rice/P170");             printf("\n [14]French Fries/P99");             printf("\n [15]Cream Dory/P100");             printf("\n [16]Chicken Pineapple Stew/P120");             printf("\n [17]Chickrn in Oyster Sauce/P120");             printf("\n [18]Mash Potato/P150");             printf("\n [19]Beef Caldereta/P220");             printf("\n [20]Buffalo wings/P180 ");             printf("Please enter how many orders d you want: ");             scanf("%d", &w);             for(int j=0;j");         printf("\n [2] Cashier >");         printf("\n [3] Server >");         printf("\n [4] Waitress >");         printf("\n [5] Hostess >");         printf("\n-----");         printf("\nPlease Enter Your Choice: ");         scanf("%d",&choice);         switch(choice) {         case 1: admin(); break;         }         system("PAUSE");         return 0; }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

My C program admin option is not working. Please help me fix it and let the function admin2 run after the correct password and explain what's wrong.

-----------

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>

void admin() {
        char pass[21];
        int loop = 1;
        int in = 1;
        int pass1;

            system("cls");

        for(loop = 1; loop<=in;) {
        printf("Enter Password: ");
        scanf("char",&pass [21]);

        pass1 = strcmp(pass, "admin");

        if (pass1 == 0)
        {
            system("cls");
            in = 0;
            printf("Password Confirm !!");

        admin();

        } else {
            system("cls");
            in = 1;
            printf("Access Denied !!");
        }

        }

}

void admin2() {
        int i,w;
        int item_code[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
        int item_code2;

        printf("Welcome: Admin --");

        printf("MENU");

                printf("What would you like to order:-  ");
            printf("Food/Price");
            printf("\n [1]Big Breakfast/P249 ");
            printf("\n [2]Daing naBangus/P130");
            printf("\n [3]Beef Steak/P120");
            printf("\n [4]Longanisa/P100");
            printf("\n [5]Pork Tocino/P110");
            printf("\n [6]Tapa/P120");
            printf("\n [7]Roast Chicken/P130");
            printf("\n [8]Sharkfin/P170");
            printf("\n [9]Bangus Sisig/P130");
            printf("\n [10]Serbesa Pork Chop/P120");
            printf("\n [11]Calamari/P180");
            printf("\n [12]Arroz Caldo/P99");
            printf("\n [13]Fried Rice/P170");
            printf("\n [14]French Fries/P99");
            printf("\n [15]Cream Dory/P100");
            printf("\n [16]Chicken Pineapple Stew/P120");
            printf("\n [17]Chickrn in Oyster Sauce/P120");
            printf("\n [18]Mash Potato/P150");
            printf("\n [19]Beef Caldereta/P220");
            printf("\n [20]Buffalo wings/P180 ");

            printf("Please enter how many orders d you want: ");
            scanf("%d", &w);

            for(int j=0;j<w;j++)
            {
                printf("Enter Item Code: ");
                scanf("%d",&item_code2);
            }
            for(i=0;i<w;i++)
            {
                printf("%d",item_code2);
            }

}

void cashier() {
}

void server() {
}

int main()
{       int choice;
        system("cls");

        printf(" WELCOME TO JOHANDY'S ORDERING SYSTEM \n");

        printf("\n [1] Admin >");
        printf("\n [2] Cashier >");
        printf("\n [3] Server >");
        printf("\n [4] Waitress >");
        printf("\n [5] Hostess >");
        printf("\n-----");
        printf("\nPlease Enter Your Choice: ");
        scanf("%d",&choice);

        switch(choice) {
        case 1: admin(); break;

        }

        system("PAUSE");
        return 0;
}
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY