Professional Documents
Culture Documents
Food1 Food2 Food3 Food4 Food5 Food6 Food7
Food1 Food2 Food3 Food4 Food5 Food6 Food7
h>
#include <ctype.h>
#include <stdlib.h>
#include <string>
char choice = 0;
int foodnum = x;
int order[100];
int orderq[100];
char foodname[100];
int quantity = 0;
int tablenum = x;
int ch = 1;
int ordnum = 1;
int i = 1;
int total[100];
do {
switch (choice) {
case '1':
choice = '3';
system("cls");
printf(" RESTAURANT MENU\n \n BUNS: \n \n");
printf(" 1. Beef Burger: $20 \n 2. Hot Dog: $15 \n
\n");
printf("\n CHICKEN: \n \n 3. Chicken Breast: $25\n 4. Chicken Wings:
$65 \n \n ");
printf(" DESSERTS: \n \n 5. Ice Cream: $5\n \n");
printf(" DRINKS: \n \n 6. Coca-Cola: $3 \n 7. Fanta:
$2 \n \n Order:(Enter 0 to finish order)\n");
while (foodnum != 0) {
printf("\n Enter Food Number: ");
scanf_s(" %d", &foodnum);
if (foodnum==0) {
system("cls");
printf("Thanks for your order. We are getting ready the dishes");
printf("\nYour table number is %d", tablenum);
printf(". Use this table number while paying the bill\n");
tablenum++;
printf("\n Further action: \n 1. Check your bill \n 2. Go to main
menu \n Enter your choice: ");
scanf_s(" %d", &ch);
if (ch == 1) {
//prices();
system("cls");
printf("Your bill: \n");
printf(" Item(s) Quantity
Price($) \n");
if (order[i] == 1) {
total[i] = 20*orderq[i];
printf(food1 " %d", orderq[i]);
printf(" piece(s) $ %d", total[i]);
}
else if (order[i] == 2) {
total[i] = 15 * orderq[i];
printf(food2 " %d", orderq[i]);
printf(" piece(s) $ %d", total[i]);
}
else if (order[i] == 3) {
total[i] = 25 * orderq[i];
printf(food3 " %d", orderq[i]);
printf(" piece(s) $ %d", total[i]);
}
else if (order[i] == 4) {
total[i] = 65 * orderq[i];
printf(food4 " %d", orderq[i]);
printf(" piece(s) $ %d", total[i]);
}
else if (order[i] == 5) {
total[i] = 5 * orderq[i];
printf(food5 " %d", orderq[i]);
printf(" piece(s) $ %d", total[i]);
}
else if (order[i] == 6) {
total[i] = 3 * orderq[i];
printf(food6 " %d", orderq[i]);
printf(" piece(s) $ %d", total[i]);
}
else if (order[i] == 7) {
total[i] = 2 * orderq[i];
printf(food7 " %d", orderq[i]);
printf(" piece(s) $ %d", total[i]);
}
}
printf(" \n");
break;
}
else if (ch == 2) {
choice == '0';
system("cls");
return main(tablenum);
}
else {
printf("whoops!");
}
}
else if (foodnum > 7) {
else {
printf(" Enter Quantity: ");
scanf_s(" %d", &quantity);
order[i] = foodnum;
orderq[i] = quantity;
ordnum++;
i++;
continue;
}
}
break;
case '2':
printf("case 2");
choice = '3';
break;
case '3':
printf("exiting");
choice = '3';
break;
default:
break;
}
while (choice != '3');
}