468,790 Members | 1,886 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,790 developers. It's quick & easy.

when i compile i keep on getting error expected unqualified id

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <malloc.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include <ctype.h>
  7. #define delivery =5
  8.  
  9. using namespace std;
  10. int choice1,choice2,n,price,pay,i,pm;
  11. char username[20],set;
  12. void loadingbar();
  13. void autoCreateMenu();
  14. void foodList();
  15. void bill();
  16.  
  17. do
  18.     {
  19.         system("cls");
  20.         printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\t\tL O G I N\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t\t1. User\n\n\t\t\t\t\t\t\t2. Admin\n\t\t\t\t\t\t\n\n\n\t\t\t\t\t\tEnter choice: ");
  21.         scanf("%d",&choice1);
  22.  
  23.         switch(choice1)
  24.         {
  25.             case 2: system("cls");
  26.  
  27.                     do{
  28.                     printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\t    A D M I N   P A N E L\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t1. Edit Menu\n\n\t\t\t\t\t\t2. Orders\n\n\t\t\t\t\t\t3. Back\n\n\n\t\t\t\t\t\tEnter choice: ");
  29.                     scanf("%d",&choice2);
  30.  
  31.                     switch(choice2)
  32.                     {
  33.                             case 1:
  34.                                 do
  35.                                 {
  36.                                     system("cls");
  37.                                     printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\t\tE D I T   M E N U\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t1. Add Items\n\n\t\t\t\t\t\t2. Edit Item\n\n\t\t\t\t\t\t3. View Menu\n\n\t\t\t\t\t\t4. Back\n\n\t\t\t\t\t\tEnter choice: ");
  38.                                     scanf("%d", &choice2);
  39.  
  40.                                     switch(choice2)
  41.                                     {
  42.                                         case 1:
  43.                                             system("cls");
  44.                                             createMenuItem();
  45.                                             getch();
  46.                                             break;
  47.  
  48.                                         case 2:
  49.                                             editItem();
  50.                                             break;
  51.  
  52.                                         case 3:
  53.                                             system("cls");
  54.                                             displayMenu();
  55.                                             printf("\n\n\t\t\t\t\t  Press any button to return to previous screen");
  56.                                             getch();
  57.                                             break;
  58.                                     }
  59.                                 }while(choice2!=4);
  60.                                 system("cls");
  61.                                 break;
  62.  
  63.  
  64.                             case 2:
  65.  
  66.                                 do
  67.                                 {
  68.                                     system("cls");
  69.                                     printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\t\tO R D E R S\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t1. Serve order\n\n\t\t\t\t\t\t2. View Orders\n\n\t\t\t\t\t\t3. Back\n\n\t\t\t\t\t\tEnter choice: ");
  70.                                     scanf("%d", &choice2);
  71.  
  72.                                     switch(choice2)
  73.                                     {
  74.                                         case 1:
  75.                                             system("cls");
  76.                                             dequeueOrder();
  77.                                             getch();
  78.                                             break;
  79.  
  80.                                         case 2:
  81.                                             system("cls");
  82.                                             displayOrder();
  83.                                             getch();
  84.                                             break;
  85.                                     }
  86.                                 }while(choice2!=3);
  87.                                 break;
  88.                         }
  89.                     }while(choice2!=3);
  90.                     break;
  91.  
  92.  
  93.             case 1: system("cls");
  94.                     printf("\n\n\n\n\n\n\t\t\t\t\t\tEnter username: ");
  95.                     ccolor(10);
  96.                     fflush(stdin);
  97.                     gets(username);
  98.                     ccolor(15);
  99.  
  100.                     do
  101.                     {
  102.                         system("cls");
  103.                         printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\tW E L C O M E , ");
  104.                         stringify(username);
  105.                         printf("\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t1. Order\n\n\t\t\t\t\t\t2. View Cart\n\n\t\t\t\t\t\t3. Proceed to Checkout\n\n\t\t\t\t\t\t0. <- Back\n\n\n\t\t\t\t\t\tEnter choice:");
  106.                         scanf("%d",&choice2);
  107.  
  108.                         switch(choice2)
  109.                         {
  110.                             case 1: pushFoodItem(username);
  111.                                     foodList();
  112.                                     break;
  113.  
  114.                             case 2: displayCart(username);
  115.                                     printf("\n\n\t\t\t\t\t  Press any button to return to previous screen");
  116.                                     getch();
  117.                                     break;
  118.  
  119.                             case 3: enqueueOrder(username);
  120.                                     displayCart(username);
  121.                                     bill();
  122.                                     ccolor(47);
  123.                                     printf("\n\n\t\t\t\t\t\t  Order placed successfully ");
  124.                                     ccolor(15);
  125.                                     printf("\n\n\t\t\t\t\t  Press any button to return to main screen");
  126.                                     getch();
  127.                                     Sleep(50);
  128.  
  129.                                     break;
  130.                         }
  131.                     }while (choice2!=0 && choice2!=3);
  132.  
  133.                     break;
  134.         }
  135.     }while(choice1!=4);
  136. }
  137.  
  138. void foodList()
  139. {
  140.     cout<<"*************************************************MENU*********************************************************"<<endl;
  141.     cout<<"*                                                                                                              *"<<endl;
  142.     cout<<"*               SET A                                SET B                               SET C                 *"<<endl;
  143.     cout<<"*       Grilled Chicken Chop                   Chicken Curry with Rice              Sweet and Sour Chicken           *"<<endl;
  144.     cout<<"*               Prawn                          Sweet and sour prawn               Prawn with vegetables        *"<<endl;
  145.     cout<<"*            Cheese Cake                            Fruit Cake                          Mango Cake             *"<<endl;
  146.     cout<<"*             Sprite                               Apple Juice                         Mango Juice             *"<<endl;
  147.     cout<<"*              RM 35                                 RM 40                                RM 45                *"<<endl;
  148.     cout<<"*                                                                                                              *"<<endl;
  149.     cout<<"*                                SET D                                 SET E                                   *"<<endl;
  150.     cout<<"*                            Fish and chips                      Grilled Lamb Chop                             *"<<endl;
  151.     cout<<"*                              Ice-cream                            Custard Pies                               *"<<endl;
  152.     cout<<"*                              Hot Choco                           Iced Green Tea                              *"<<endl;
  153.     cout<<"*                                RM 30                                 RM 30                                   *"<<endl;
  154.     cout<<"****************************************************************************************************************"<<endl;
  155. }
  156.  
  157. void bill();
  158.  
  159. {
  160.     if(set=='a'||set=='A')
  161.         price=35
  162.         cout<<"Total= RM 35";
  163.     else if(set=='b'||set=='B')
  164.         cout<<"Total= RM 40";
  165.     else if(set=='c'||set=='C')
  166.         cout<<"Total= RM 45";
  167.     else if(set=='d'||set=='D')
  168.         cout<<"Total= RM 30";
  169.     else if(set=='e'||set=='E')
  170.         cout<<"Total= RM 30";
  171.     else
  172.         cout<<"SORRY! You enter the wrong item. Please try again.";
  173.         cin>>set;
  174.  
  175.     cout<<"Quantity: "<<i<<endl;
  176.  
  177.     cout<<"Select the payment method: "<<endl;
  178.     cout<<" a. Membership"<<endl;
  179.     cout<<" b. Cash"<<endl;
  180.     cin>>pm;
  181.     if(pm=='a')
  182.     {
  183.         cout<<"Account Balance: RM 100"<<endl;
  184.         pay=balance-(5+(i*price));
  185.     }
  186. }
  187.  
  188.  
  189.  
  190.  
  191.  
  192. /*//******************************************************************************************************************************************
  193. //                                      wait function defenation which use for exit function
  194. //*******************************************************************************************************************************************
  195. void wait ( int seconds )
  196. //this function contains void type & returns nothing
  197.  
  198.  
  199. {
  200.  clock_t waitend;
  201.  waitend = clock () + seconds * CLOCKS_PER_SEC ;
  202.  while (clock() < waitend) {}
  203. }*/
Jun 21 '21 #1
1 2490
dev7060
457 Expert 256MB
You can't have code outside of functions except for global vars, function declarations, macros, etc.
Jun 22 '21 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.