My C program admin option is not working. Please help me fix it 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; }
My C program admin option is not working. Please help me fix it 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; }
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
My C program admin option is not working. Please help me fix it 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
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education