Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

#include<stdio.

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

#define food1 ". Beef Burger "


#define food2 ". Hot Dog "
#define food3 ". Chicken Breast "
#define food4 ". Chicken Wings "
#define food5 ". Ice Cream "
#define food6 ". Coca-Cola "
#define food7 ". Fanta "

int main(int x=0) {

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];

printf("*** Welcome to the SKKU Restaurant *** \n");


printf("-------------------------------------- \n");
printf(" SYSTEM MENU \n");
printf("\n 1. Create New Order");
printf("\n \n 2. Show Bill");
printf("\n \n 3. Exit \n \n");
printf("====================================== \n");
//printf(" %d", tablenum);

do {

printf("\nEnter Choice: ");


scanf_s(" %c", &choice);

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");

for (i = 1;i < ordnum;i++) {

printf("\n %d", i);

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) {

printf(" Invalid option. Please choose from the options on the


menu.\n");
}

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:

printf("Invalid Choice. Enter a number between 1 to 3.\n");

break;

}
while (choice != '3');
}

You might also like