Advertisement
Guest User

food ordering system

a guest
Dec 6th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 16.14 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <conio.h>
  4. struct order{
  5.     char name[50];
  6.     int order_number;
  7.     int number_of_food;
  8.     int cost;
  9.     int number_of_item_code;
  10. }p[10000];
  11. int order_count = 0, served_count = 0, waiting_now = 0;
  12.  
  13. int order ()
  14. {
  15.     int n, in, qu;
  16.     printf ("please enter your name: ");
  17.     gets (p[order_count].name);
  18.     p[order_count].order_number = 10000+order_count;
  19.  
  20.  
  21.  
  22.     p[order_count].number_of_food = n;
  23.     p[order_count].cost = 0;
  24.     p[order_count].number_of_food = 0;
  25. printf ("How many items you want to order? \n");
  26.     scanf ("%d", &n);
  27.     while (n--){
  28.         int in = items();
  29.  
  30. level1:
  31.         switch(in){
  32.             case 1:{
  33.  
  34.         printf ("Enter the size of Burger: 1. 200gm  2. 300gm: \n\n");
  35.         int i;
  36.         scanf ("%d", &i);
  37.         getchar();
  38.  
  39.         printf ("Please enter the quantity: \n");
  40.         scanf ("%d", &qu);
  41.         getchar();
  42.  
  43.         p[order_count].number_of_food +=qu;
  44.  
  45.         if (i==1) p[order_count].cost += (130*qu);
  46.  
  47.         else p[order_count].cost += (180*qu);
  48.         printf("Do you want to choose another Burger?\nIf yes press 'Y' or no press 'N'\n");
  49.         char temp;
  50.     scanf("%c", &temp);
  51.     if (temp == 'y' || temp == 'Y')
  52.         goto level1;
  53.         break;
  54.     }
  55.     case 2 :{
  56.         printf ("Enter the size of Chicken Pizza: 1. 12inch  2. 14inch  3. 16inch: \n");
  57.         int i;
  58.         scanf ("%d", &i);
  59.         getchar();
  60.  
  61.         printf ("Please enter the quantity: ");
  62.         scanf ("%d", &qu);
  63.         getchar();
  64.  
  65.         p[order_count].number_of_food +=qu;
  66.  
  67.         if (i==1) p[order_count].cost += (750*qu);
  68.  
  69.         else if (i==2) p[order_count].cost += (975*qu);
  70.  
  71.         else  p[order_count].cost += (1250*qu);
  72. printf("Do you want to choose another Chicken Pizza?\nIf yes press 'Y' or no press 'N'\n");
  73.         char temp;
  74.     scanf("%c", &temp);
  75.     if (temp == 'y' || temp == 'Y')
  76.         goto level1;
  77.         break;
  78.     }
  79.     case 3 :{
  80.         printf ("Enter the amount of Chicken: 1. 1 pcs  2. 4 pcs  3. 10 pcs: \n");
  81.         int i;
  82.         scanf ("%d", &i);
  83.         getchar();
  84.  
  85.         printf ("Please enter the quantity: ");
  86.         scanf ("%d", &qu);
  87.         getchar();
  88.  
  89.         p[order_count].number_of_food +=qu;
  90.         p[order_count].number_of_item_code+=in;
  91.  
  92.         if (i==1) p[order_count].cost += (85*qu);
  93.  
  94.         else if (i==2) p[order_count].cost += (320*qu);
  95.  
  96.         else  p[order_count].cost += (790*qu);
  97. printf("Do you want to choose another Chicken?\nIf yes press 'Y' or no press 'N'\n");
  98.         char temp;
  99.     scanf("%c", &temp);
  100.     if (temp == 'y' || temp == 'Y')
  101.         goto level1;
  102.         break;
  103.     }
  104.     case 4 :{
  105.         printf ("Enter the size of Grilled Chicken: 1. Quarter  2. half  3. full: \n");
  106.         int i;
  107.         scanf ("%d", &i);
  108.         getchar();
  109.  
  110.         printf ("Please enter the quantity: ");
  111.         scanf ("%d", &qu);
  112.         getchar();
  113.  
  114.         p[order_count].number_of_food +=qu;
  115.  
  116.         if (i==1) p[order_count].cost += (70*qu);
  117.  
  118.         else if (i==2) p[order_count].cost += (140*qu);
  119.  
  120.         else  p[order_count].cost += (250*qu);
  121. printf("Do you want to choose another Grilled Chicken?\nIf yes press 'Y' or no press 'N'\n");
  122.         char temp;
  123.     scanf("%c", &temp);
  124.     if (temp == 'y' || temp == 'Y')
  125.         goto level1;
  126.         break;
  127.     }
  128.     case 5 :{
  129.         printf ("Enter the size of Noodles: 1. half  2. full: \n");
  130.         int i;
  131.         scanf ("%d", &i);
  132.         getchar();
  133.  
  134.         printf ("Please enter the quantity: \n");
  135.         scanf ("%d", &qu);
  136.         getchar();
  137.  
  138.         p[order_count].number_of_food +=qu;
  139.  
  140.         if (i==1) p[order_count].cost += (130*qu);
  141.  
  142.         else p[order_count].cost += (250*qu);
  143. printf("Do you want to choose anotherNoodles?\nIf yes press 'Y' or no press 'N'\n");
  144.         char temp;
  145.     scanf("%c", &temp);
  146.     if (temp == 'y' || temp == 'Y')
  147.         goto level1;
  148.         break;
  149.     }
  150.     case 6 :{
  151.         printf ("Enter the size of Pasta: 1. half  2. full: \n");
  152.         int i;
  153.         scanf ("%d", &i);
  154.         getchar();
  155.  
  156.         printf ("Please enter the quantity: ");
  157.         scanf ("%d", &qu);
  158.         getchar();
  159.  
  160.         p[order_count].number_of_food +=qu;
  161.  
  162.         if (i==1) p[order_count].cost += (120*qu);
  163.  
  164.         else p[order_count].cost += (240*qu);
  165. printf("Do you want to choose another Pasta?\nIf yes press 'Y' or no press 'N'\n");
  166.         char temp;
  167.     scanf("%c", &temp);
  168.     if (temp == 'y' || temp == 'Y')
  169.         goto level1;
  170.         break;
  171.     }
  172.     case 7 : {
  173.         printf ("1 Full (Fried rice, 2pcs chicken, salad, 1 Drinks): \n");
  174.  
  175.         printf ("Please enter the quantity: ");
  176.         scanf ("%d", &qu);
  177.         getchar();
  178.  
  179.         p[order_count].number_of_food +=qu;
  180.         p[order_count].cost += (550*qu);
  181.         break;
  182.     }
  183.     case 8 : {
  184.         printf ("1 Full (1 Cheese Burger, 2pcs Chicken wings,1 Colasaw, 1 Drink)\n");
  185.  
  186.         printf ("Please enter the quantity: ");
  187.         scanf ("%d", &qu);
  188.         getchar();
  189.  
  190.         p[order_count].number_of_food +=qu;
  191.         p[order_count].cost += (350*qu);
  192.         break;
  193.     }
  194.     case 9 : {
  195.         printf ("1 Full (Vegetable Rice, 2pcs chicken,Beef curry, chawmin, salad, 1 Drink)\n");
  196.  
  197.         printf ("Please enter the quantity: ");
  198.         scanf ("%d", &qu);
  199.         getchar();
  200.  
  201.         p[order_count].number_of_food +=qu;
  202.         p[order_count].cost += (750*qu);
  203.         break;
  204.     }
  205.     case 10 :{
  206.         printf ("1 Full (Baked pasta, mini pizza, 1 Burger, French Fry, 1 Drink)\n");
  207.  
  208.         printf ("Please enter the quantity: ");
  209.         scanf ("%d", &qu);
  210.         getchar();
  211.  
  212.         p[order_count].number_of_food +=qu;
  213.         p[order_count].cost += (950*qu);
  214.         break;
  215.     }
  216.     case 11 :{
  217.         printf ("1 Full (2 Chicken shwarma, 2pcs ginger breads, 2 Grills, French Fry, 1 Drink)\n");
  218.  
  219.         printf ("Please enter the quantity: ");
  220.         scanf ("%d", &qu);
  221.         getchar();
  222.  
  223.         p[order_count].number_of_food +=qu;
  224.         p[order_count].cost += (480*qu);
  225.         break;
  226.     }
  227.     case 12 :{
  228.         printf ("1 Full (Mixed Rice, Mexican curry, 1 big colasaw, pron curry, 2 drinks)\n");
  229.  
  230.         printf ("Please enter the quantity: ");
  231.         scanf ("%d", &qu);
  232.         getchar();
  233.  
  234.         p[order_count].number_of_food +=qu;
  235.         p[order_count].cost += (760*qu);
  236.         break;
  237.     }
  238.     case 13 :{
  239.         printf ("1 slice Pudding\n");
  240.  
  241.         printf ("Please enter the quantity: ");
  242.         scanf ("%d", &qu);
  243.         getchar();
  244.  
  245.         p[order_count].number_of_food +=qu;
  246.         p[order_count].cost += (80*qu);
  247.         break;
  248.     }
  249.     case 14 :{
  250.         printf ("1 slice Black Forest cake\n");
  251.  
  252.         printf ("Please enter the quantity: ");
  253.         scanf ("%d", &qu);
  254.         getchar();
  255.  
  256.         p[order_count].number_of_food +=qu;
  257.         p[order_count].cost += (160*qu);
  258.         break;
  259.     }
  260.     case 15 :{
  261.         printf ("1 slice Red Velvet\n");
  262.  
  263.         printf ("Please enter the quantity: ");
  264.         scanf ("%d", &qu);
  265.         getchar();
  266.  
  267.         p[order_count].number_of_food +=qu;
  268.         p[order_count].cost += (195*qu);
  269.         break;
  270.     }
  271.     case 16 :{
  272.         printf ("1 glass Chocolate moose\n");
  273.  
  274.         printf ("Please enter the quantity: ");
  275.         scanf ("%d", &qu);
  276.         getchar();
  277.  
  278.         p[order_count].number_of_food +=qu;
  279.         p[order_count].cost += (350*qu);
  280.         break;
  281.     }
  282.     case 17 :{
  283.         printf ("Enter the taste of Ice-Cream: 1. chocolate  2. strawberry  3. mango\n");
  284.         int i;
  285.         scanf ("%d", &i);
  286.         getchar();
  287.  
  288.         printf ("Please enter the quantity: ");
  289.         scanf ("%d", &qu);
  290.         getchar();
  291.  
  292.         p[order_count].number_of_food +=qu;
  293.  
  294.         if (i==1) p[order_count].cost += (130*qu);
  295.  
  296.         else if (i==2) p[order_count].cost += (120*qu);
  297.  
  298.         else  p[order_count].cost += (125*qu);
  299. printf("Do you want to choose another Ice-Cream?\nIf yes press 'Y' or no press 'N'");
  300.         char temp;
  301.     scanf("%c", &temp);
  302.     if (temp == 'y' || temp == 'Y')
  303.         goto level1;
  304.         break;
  305.     }
  306.     case 18 :{
  307.         printf ("Enter the size of Apple pie: 1. half  2. full\n");
  308.         int i;
  309.         scanf ("%d", &i);
  310.         getchar();
  311.  
  312.         printf ("Please enter the quantity: ");
  313.         scanf ("%d", &qu);
  314.         getchar();
  315.  
  316.         p[order_count].number_of_food +=qu;
  317.  
  318.         if (i==1) p[order_count].cost += (120*qu);
  319.  
  320.         else p[order_count].cost += (240*qu);
  321. printf("Do you want to choose another Apple pie?\nIf yes press 'Y' or no press 'N'");
  322.         char temp;
  323.     scanf("%c", &temp);
  324.     if (temp == 'y' || temp == 'Y')
  325.         goto level1;
  326.         break;
  327.     }
  328.     case 19 :{
  329.         printf ("Enter the size of Cocacola: 1. 250ml  2. 500ml\n");
  330.         int i;
  331.         scanf ("%d", &i);
  332.         getchar();
  333.  
  334.         printf ("Please enter the quantity: ");
  335.         scanf ("%d", &qu);
  336.         getchar();
  337.  
  338.         p[order_count].number_of_food +=qu;
  339.  
  340.         if (i==1) p[order_count].cost += (25*qu);
  341.  
  342.         else p[order_count].cost += (50*qu);
  343. printf("Do you want to choose another Cocacola?\nIf yes press 'Y' or no press 'N'");
  344.         char temp;
  345.     scanf("%c", &temp);
  346.     if (temp == 'y' || temp == 'Y')
  347.         goto level1;
  348.         break;
  349.     }
  350.     case 20 :{
  351.         printf ("Enter the size of Fanta: 1. 250ml  2. 500ml\n");
  352.         int i;
  353.         scanf ("%d", &i);
  354.         getchar();
  355.  
  356.         printf ("Please enter the quantity: ");
  357.         scanf ("%d", &qu);
  358.         getchar();
  359.         p[order_count].number_of_food +=qu;
  360.  
  361.         if (i==1) p[order_count].cost += (30*qu);
  362.  
  363.         else p[order_count].cost += (60*qu);
  364. printf("Do you want to choose another Fanta?\nIf yes press 'Y' or no press 'N'");
  365.         char temp;
  366.     scanf("%c", &temp);
  367.     if (temp == 'y' || temp == 'Y')
  368.         goto level1;
  369.  
  370.         break;
  371.     }
  372.     case 21 :{
  373.         printf ("Enter the size of sprite: 1. 250ml  2. 500ml\n");
  374.         int i;
  375.         scanf ("%d", &i);
  376.         getchar();
  377.  
  378.         printf ("Please enter the quantity: ");
  379.         scanf ("%d", &qu);
  380.         getchar();
  381.  
  382.         p[order_count].number_of_food +=qu;
  383.  
  384.         if (i==1) p[order_count].cost += (25*qu);
  385.  
  386.         else p[order_count].cost += (50*qu);
  387. printf("Do you want to choose another sprite?\nIf yes press 'Y' or no press 'N'");
  388.         char temp;
  389.     scanf("%c", &temp);
  390.     if (temp == 'y' || temp == 'Y')
  391.         goto level1;
  392.         break;
  393.     }
  394.     case 22 :{
  395.         printf ("350ml of Cocktail\n");
  396.  
  397.         printf ("Please enter the quantity: ");
  398.         scanf ("%d", &qu);
  399.         getchar();
  400.  
  401.         p[order_count].number_of_food +=qu;
  402.         p[order_count].cost += (350*qu);
  403.         break;
  404.     }
  405.     case 23 :{
  406.         printf ("350ml of Blue-lady\n");
  407.  
  408.         printf ("Please enter the quantity: ");
  409.         scanf ("%d", &qu);
  410.         getchar();
  411.  
  412.         p[order_count].number_of_food +=qu;
  413.         p[order_count].cost += (250*qu);
  414.         break;
  415.     }
  416.     case 24 :{
  417.         printf ("350ml of Crashares\n");
  418.  
  419.         printf ("Please enter the quantity: ");
  420.         scanf ("%d", &qu);
  421.         getchar();
  422.  
  423.         p[order_count].number_of_food +=qu;
  424.         p[order_count].cost += (450*qu);
  425.         break;
  426.     }
  427.     default : {
  428.         printf ("Invalid selection try again\n");
  429.         n++;
  430.     }
  431.         }
  432.         printf("item code\n",p[order_count].number_of_item_code);
  433.     }
  434.  
  435.     printf ("\nNumber of food ordered %d\n", p[order_count].number_of_food);
  436.     printf ("\nThank you %s for your order.\nYour bill is %dtk.\nPlease wait while we prepare the food.\n\n", p[order_count].name, p[order_count].cost);
  437.     order_count ++;
  438. }
  439.  
  440. int items ()
  441. {
  442.     printf("1. Fast-food\n2. Combo\n3. Desert\n4. Beverage\n");
  443.     printf("Please Enter Item Number:  ");
  444.     int item_number, in;
  445.  
  446.     scanf("%d",&item_number);
  447.  
  448.     switch (item_number){
  449.     case 1:
  450.         {
  451.             printf("#Item Code#------Description--------------------Size--------------------Price(tk)\n\n");
  452.             printf("[1]----------------Burger---------------------200/300gm------------------130/180\n");
  453.             printf("[2]-------------Chicken Pizza----------------12/14/16inch---------------750/975/1250\n");
  454.             printf("[3]-------------Fried Chicken--------------1/4/10 pcs-----------------85/320/790\n");
  455.             printf("[4]------------Grilled Chicken------------Quarter/Half/Full----------70/140/250\n");
  456.             printf("[5]----------------Noodles---------------------Half/Full------------------130/250\n");
  457.             printf("[6]-----------------Pasta----------------------Half/Full------------------120/240\n");
  458.             printf ("Enter Chosen Item Code: \n");
  459.             scanf ("%d", &in);
  460.             return in;
  461.         }
  462.     case 2:
  463.         {
  464.             printf("Item Code#-----------------Description-----------------------------------------------Size--------------------Price(tk)\n\n");
  465.             printf("[7]---------Fried rice, 2pcs chicken, salad, 1 Drinks--------------------------------Full----------------------550\n");
  466.             printf("[8]---------1 Cheese Burger, 2pcs Chicken wings,1 Colasaw, 1 Drink-------------------Full----------------------350\n");
  467.             printf("[9]---------Vegetable Rice, 2pcs chicken,Beef curry, chawmin, salad, 1 Drink---------Full----------------------750\n");
  468.             printf("[10]--------Baked pasta, mini pizza, 1 Burger, French Fry, 1 Drink-------------------Full----------------------950\n");
  469.             printf("[11]--------2 Chicken shwarma, 2pcs ginger breads, 2 Grills, French Fry, 1 Drink-----Full----------------------480\n");
  470.             printf("[12]--------Mixed Rice, Mexican curry, 1 big colasaw, pron curry, 2 drinks-----------Full----------------------760\n");
  471.             printf ("\nEnter Chosen Item Code: \n");
  472.             scanf ("%d", &in);
  473.             return in;
  474.         }
  475.     case 3:
  476.         {
  477.             printf("Item Code#   Description-------------------Size--------------------Price(tk)\n\n");
  478.             printf("[13]---------Pudding-----------------------1pcs----------------------80\n");
  479.             printf("[14]---------Black Forest cake-------------1slice--------------------160\n");
  480.             printf("[15]---------Red Velvet--------------------1 slice-------------------195\n");
  481.             printf("[16]---------Chocolate moose---------------1 Glass-------------------350\n");
  482.             printf("[17]---------Ice-Cream-----------(chocolate/strawberry/mango)----130/120/125\n");
  483.             printf("[18]---------Apple pie---------------------Half/Full--------------120/240\n");
  484.             printf ("\nEnter Chosen Item Code: \n");
  485.             scanf ("%d", &in);
  486.             return in;
  487.         }
  488.     case 4:
  489.         {
  490.             printf("#Item Code#-------Description-----------------------Size--------------------Price(tk)\n\n");
  491.             printf("[19]---------------Cocacola---------------------250ml/500ml------------------25/50\n");
  492.             printf("[20]---------------Fanta------------------------250ml/500ml------------------30/60\n");
  493.             printf("[21]---------------sprite-----------------------250ml/500ml------------------25/50\n");
  494.             printf("[22]---------------Cocktail------------------------350ml---------------------350\n");
  495.             printf("[23]---------------Blue-lady-----------------------350ml---------------------250\n");
  496.             printf("[24]---------------Crashares-----------------------350ml---------------------450\n");
  497.             printf ("\nEnter Chosen Item Code: \n");
  498.             scanf ("%d", &in);
  499.             return in;
  500.         }
  501.     }
  502. }
  503. int main ()
  504. {
  505.     printf ("\t\t     \"WELCOME TO 404 NOT FOUND CAFE\"\n");
  506.     while (1){
  507.         printf ("1. Menu\n2. Exit\n");
  508.         printf("Press '1' to see Menu\nPress '2' to Exit\n");
  509.  
  510.         int in;
  511.         scanf ("%d", &in);
  512.         getchar ();
  513.         switch (in){
  514.             case 1 : {
  515.                 order ();
  516.                 break;
  517.             }
  518.             case 2 : {
  519.                 break;
  520.             }
  521.             }
  522.         }
  523.         return 0;
  524.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement