Error: statement missing at line

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dianaroslan
    New Member
    • Mar 2010
    • 5

    Error: statement missing at line

    have an error in this coding.
    the error is statement missing at line (78,11)
    thank you.

    Code:
    #include <iostream>
    #include <conio>
    const int listSize=2;
    struct menuItemType
    {
    	char menuItem [50];
       double menuPrice,Totaltax,price,tax,totalPrice;
    };
    
    void showMenu (menuItemType menuList[], int listSize);
    void showMenu (menuItemType menuList[], int listSize)
    {
    	cout<<"1	:PLAIN EGG       :    $1.45"<<endl;
       cout<<"2	:BACON AND EGG   :    $2.45"<<endl;
       cout<<"3	:MUFFIN          :    $0.99"<<endl;
       cout<<"4	:FRENCH TOAST    :    $1.99"<<endl;
       cout<<"5	:FRUIT BASKET    :    $2.49"<<endl;
       cout<<"6	:CEREAL          :    $0.69"<<endl;
       cout<<"7	:COFFEE          :    $0.50"<<endl;
       cout<<"8	:TEA             :    $0.75"<<endl;
    
    }
    
    void getData (menuItemType menuList[],char menuItem, int listSize);
    void getData (menuItemType menuList[],char menuItem, int listSize)
    {
     float price;
     if (menuItem==1)
    	price= 1.45;
     else if (menuItem==2)
     	price= 2.45;
     else if (menuItem==3)
     	price=0.99;
     else if (menuItem==4)
     	price=1.99;
     else if (menuItem==5)
     	price=2.49;
     else if (menuItem==6)
     	price=0.69;
     else if (menuItem==7)
     	price=0.50;
     else if (menuItem==8)
     	price=0.75;
    
    
     int c=1;
     while (menuItem!= 9)
      {
      		cout<<"ENTER THE MENU   :";
          cin.getline(menuList[listSize].menuItem,50);
          c++;
      }
    
    }
    
    void printCheck (menuItemType menuList[],menuItemType menuPrice, int listSize);
    void printCheck (menuItemType menuList[],menuItemType menuPrice, int listSize)
    {
    	cout<<"WELCOME TO JOHNNY'S RESTAURANT"<<endl;
       cout<<endl;
       cout<<"YOUR ORDER  :"<< menuList[listSize].menuItem<<endl;
    
       float totalPrice;
       float tax=0.05;
       float Totaltax;
       menuPrice.Totaltax=menuPrice.price*menuPrice.tax;
       menuPrice.totalPrice=(menuPrice.totalPrice+menuPrice.price)*menuPrice.Totaltax;
    
       cout<<"TAX  			:"<<menuPrice.Totaltax<<endl;
       cout<<"TOTAL PRICE	:"<<menuPrice.totalPrice<<endl;
    }
    
    void main()
    {
       menuItemType menuList[listSize];
    
       showMenu (menuList,listSize)
       getData (menuList,listSize,menuItem)
       printCheck (menuList,listSize,menuPrice)
    
       getch();
    }
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Look at lines 77 , 78 and 79 they are all missing the ; at the end of them just like the error says.

    main does not return void, it always returns int anthing else is undefined behaviour.

    For all your functions putting the declaration on the line before the definition is pointless. You may as well remove all those declarations.

    Comment

    Working...