473,288 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,288 software developers and data experts.

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 3303
dev7060
626 Expert 512MB
You can't have code outside of functions except for global vars, function declarations, macros, etc.
Jun 22 '21 #2

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

Similar topics

1
by: madhu8065 | last post by:
Dim ipadd 'As String; ipadd =HttpContext.Current.Request.ServerVariables; if (string.IsNullOrEmpty(ipadd) || ipadd.Equals("unknown", StringComparison.OrdinalIgnoreCase)) { ipadd =...
12
by: sam23 | last post by:
Hi all, im new to this programming language and i tried to use my Xcode to build and run this code but i got a error :(, and another error is i need a help guys #include <GLUT/glut.h>...
1
by: SilentNinja | last post by:
Okay so I'm in a intro to programming class and for an assignment we're supposed to develop a program that gives the ingredients for fruit punch and convert the normal service size to a service size...
1
by: britishfood | last post by:
File could not be uploaded.A generic error occurred in GDI+. > Process Begun...Calculated dimensions...Created graphic based on new bitmap...Set properties on new graphic based on resized...
2
by: atiqah | last post by:
#include <iostream> using namespace std; class DB; class DM{ public: DM(){} DM (float meter, float cm); friend int func(DM,DB); };
17
by: AffinityCreate | last post by:
Hi, Not quite sure if someone will be able to help me but.......... I am currently trying to build a menu layout for a 20x4 LCD. I originally had the LCD working with the keypad to have a...
3
by: AffinityCreate | last post by:
Hi I am trying to add the DS1307 to my project via I2C using both a keypad and LCD. So far I have been able to get my project working with a passcode entry, led, keypad input and LCD display. I as...
2
by: Easay9 | last post by:
I have an assignment that is giving me this annoying error I am wondering if anyone might know what is wrong I am by no means an expert and will take all feedback.
2
by: vikram77 | last post by:
this is my code: I am getting an error:expected unqualified-id before string constant #include<iostream> #include<string> "version":1 "name":"Example project" "build_commands": {...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.