declaration error appearing on/after { below void order() please help what is my error?

#include<stdio.h>
#include<time.h>
#include<process.h>
#include<string.h>
#include<conio.h>
#include<dos.h>

/*Placement*/
void order();
void lo();
char *date;
/*header*/
char hdr[]="\t\t\t\t    Pizza Hut\n\t\t\t\t  Billing System\n\t\t\t   Philippines Food Corporation\n";
/*opening*/
void main()
{
clrscr();
int choice;
printf("                                    ===                            \n");
printf("                                  ========                         \n");
printf("                                ==============                     \n");
printf("                             ====================                  \n");
printf("                           =========================               \n");
printf("                       ===================================         \n");
printf("                  =============================================    \n");
printf("              =====================================================\n\n\n");
printf("\t  ========   ==                          ==    ==            ==   \n");
printf("\t  ==     ==  ==                          ==    ==            ==   \n");
printf("\t  ==     ==                              ==    ==            ==   \n");
printf("\t  ==     ==  ==  ======  ====== ======   ========  ==   == ====== \n");
printf("\t  ========   ==     ==      ==      ==   ==    ==  ==   ==   ==   \n");
printf("\t  ==         ==    ==      ==   ======   ==    ==  ==   ==   ==   \n");
printf("\t  ==         ==   ==      ==    =   ==   ==    ==  ==   ==   ==   \n");
printf("\t  ==         ==  ======  =====  ======   ==    ==  =======   ==   \n\n\n");
printf("\t\t\t     [ 1 ] - Make an order.\n");
printf("\t\t\t     [ 2 ] - Exit.\n\n");
printf("\t\t\t     Enter your choice:  ");
scanf("%d",&choice);
/*declaratio*/
    switch (choice)
    {
    case 1:order();
    case 2:exit(1);
    }
        void order()
        {
        char name[25]; char d, dt;
        int choose, b, payment, i, ssl=0, bfl=0, s=0, pc=0, coker=0, cokel=0, itr=0, itl=0, minr=0, minl=0;
        float c, e=0, f, orig, total=0, vat, total_vat=0, change, op=0, money;
/*name*/
        printf("\n\n\t\t\t  Name: ");
        scanf("%s",&name);
        printf("\n\n\n\t\t\t\t    Thank you\n\t\t\t\tProcessing data...");
        delay(2500);
        clrscr();
/*menu*/
        menu:
        clrscr();
        printf("%s",hdr);
        printf("\n================================================================================");
        printf("\t\t\t\t       MENU\n");
        printf("================================================================================");
        printf("\n\tCode:\tPizza flavors:  \t       Price\t\t\n");
        printf("\t(1)  \t\tHawaiian Supreme       \tPhp250.00\t\t\n");
        printf("\t(2)  \t\tCheesy Pepperoni       \tPhp275.00\t\t\n");
        printf("\t(3)  \t\tMeat Lovers Pizza      \tPhp260.00\t\t\n");
        printf("\t(4)  \t\tBacon Supreme          \tPhp290.00\t\t\n");
        printf("\t(5)  \tDrinks available:\n\t\t\t>Coke\n\t\t\t>Iced Tea\n\t\t\t>Mineral Water\n\n");
        printf("================================================================================\n");
        printf("Press your Order:\t");
        scanf("%d",&choose);
        printf("\n===============================================================================\n");
/*order*/
            switch(choose)
            {
            case 1:
            {
            printf("\n\tHawaiian Supreme (Php250.00 each)\n\tHow many do you want?:\t");
            scanf("%d",&b);
            orig=250;
/*computation*/
            vat=(b*orig)*.10;
            e=vat;
            ssl=ssl+b;
            f=b*orig;
            c=b*orig;
            total+=c;
            total_vat+=e;
            op+=f;
            printf("\n\tHawaiian Supreme = Php%.2f\n",c);
            printf("\n=============================================================================\n");
            printf("\n\n\t\t\t\tTotal price:\tPhp%.2f",total);
            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
            d=getche();
            choice:
/*dinein/takeout*/
                switch(d)
                {
                    case 'y': case 'Y':
                    {
                    clrscr();goto menu;
                    }
                    case 'n': case 'N':
                    {
                    printf("\n\n\t(D/d) Dine in or (T/t) Take out?\n");
                    printf("\t\tYour choice: ");
                    scanf("%s",&dt);
                    printf("\n\n\t\t\t\tTHANK YOU:)\n\n\tOriginal Price:\t\t\t\tPhp%.2f\n\tVAT:\t\t\t\t\tPhp%.2f\n\n\tYour bill is:\t\t\t\tPhp%.2f",op-total_vat,total_vat,total);
                    money:
                    printf("\n\tYour Payment please:\tPhp");
                    scanf("%d",&payment);
/*payment*/
                        if(payment<total)
                        {
                        printf("\n\tPayment:\t\t\t\tPhp%d.00 'NOT ENOUGH PAYMENT",payment);
                        goto money;
                        }

                        else if(payment>=total)
                        {
                        printf("\n\tPayment: \t\t\t\tPhp%d.00",payment);
                        change=payment-total;
                        printf("\n\tChange:\t\t\t\t\tPhp%.2f",change);
                        printf("\n\n\t\t\t\tThank You!\n\t\t\tWait for your reciept %s\n\n\t\t\t   \n",name);
/*reciept*/
                        getche();
                        delay(2500);
                        clrscr();
                        printf("\t\t\t\t      PIZZA HUT\n");
                        printf("\t\t\t          Nasugbu, Batangas\n");
                        printf("\t\t       Philippine Pizza Inc POS02 SN: 41-FB492\n");
                        printf("\t\t\t       TIN 006-021-629-001VAT\n");
                        printf("\t\t\t          POS01 SN:41-F8477\n");
                        printf("\t\t=================================================\n");
                        struct date d;
                        getdate(&d);
                        time_t now=time(NULL);
                        struct tm *tm=localtime(&now);
                        printf("\t\t%d/%d/%d %d:%d\t\t%s\t      OR#01159302\n",d.da_mon,d.da_day,d.da_year,tm->tm_hour,tm->tm_min,name);
                        printf("\t\t=================================================\n");
                            if ((dt=='d')||(dt=='D'))
                            {printf("\t\t---------------------DINE-IN---------------------\n");}
                            else if ((dt=='t')||(dt=='T'))
                            {printf("\t\t---------------------TAKE-OUT--------------------\n");}
                            if(ssl>0)
                            {printf("\n\t\t%d Hawaiian Supreme   @250\t\t  %d.00",ssl, ssl*250);}
                            if(bfl>0)
                            {printf("\n\t\t%d Cheesy Pepperoni   @275\t\t  %d.00",bfl, bfl*275);}
                            if(s>0)
                            {printf("\n\t\t%d Meat Lovers Pizza  @260\t\t  %d.00",s, s*260);}
                            if(pc>0)
                            {printf("\n\t\t%d Bacon Supreme      @290\t\t  %d.00",pc, pc*290);}
                            if(coker>0)
                            {printf("\n\t\t%d   Coke (Regular)    @28\t\t  %d.00",coker, coker*28);}
                            if(cokel>0)
                            {printf("\n\t\t%d   Coke (Large)      @39\t\t  %d.00",cokel, cokel*39);}
                            if(itr>0)
                            {printf("\n\t\t%d   Iced Tea (Reg)    @28\t\t  %d.00",itr, itr*28);}
                            if(itl>0)
                            {printf("\n\t\t%d   Iced Tea (Large)  @39\t\t  %d.00",itl, itl*39);}
                            if(minr>0)
                            {printf("\n\t\t%d   Mineral Water (R) @20\t\t  %d.00",minr, minr*20);}
                            if(minl>0)
                            {printf("\n\t\t%d   Mineral Water (L) @27\t\t  %d.00",minl, minl*27);}
                        printf("\n\t\t---                                   \t  -------");
                        printf("\n\t\t%d Item(s)    \t\t\t\t  %.2f",ssl+bfl+s+pc+coker+cokel+itr+itl+minr+minl,total);
                        printf("\n\t\t   TOTAL DUE\t\t\t\t  %.2f\n",total);
                        printf("\t\t   CASH\t\t\t\t\t  %d.00",payment);
                        printf("\t\t\t\t   CHANGE DUE\t\t\t\t  %.2f",change);
                        printf("\n\n\t\t   VATable Sales\t\t\t  %.2f",op-total_vat);
                        printf("\n\t\t   VAT\t\t\t\t\t  %.2f\n\n",total_vat);
                        printf("\n\t\t\tTHANK YOU.. PLEASE COME AGAIN :)");
                        }
                    break;}
                    default:
                    {
                    clrscr();
                    printf("\t\tPress(Y) for YES.\n\t\tPress(N) for NO.\n\t\t");
                    break;}
                }
            break;}
            }

            case 2:
            {
            printf("\n\tCheesy Pepperoni (Php275.00 each)\n\tHow many do you want?:\t");
            scanf("%d",&b);
            orig=275;
            vat=(b*orig)*.10;
            e=vat;
            bfl=bfl+b;
            f=b*orig;
            c=b*orig;
            total+=c;
            total_vat+=e;
            op+=f;
            printf("\n\tCheesy Pepperoni = Php%.2f\n",c);
            printf("\n=============================================================================\n");
            printf("\n\n\t\t\t\tTotal Price =\tPhp%.2f",total);
            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
            d=getche();
            goto choice;
            }

            case 3:
            {
            printf("\n\tMeat Lovers Pizza (Php260.00 each)\n\tHow many do you want?:\t");
            scanf("%d",&b);
            orig=260;
            vat=(b*orig)*.10;
            e=vat;
            s=s+b;
            f=b*orig;
            c=b*orig;
            total+=c;
            total_vat+=e;
            op+=f;
            printf("\n\tMeat Lover Pizza = Php%.2f\n",c);
            printf("\n=============================================================================\n");
            printf("\n\n\t\t\t\tTotal price of your order=\tPhp%.2f",total);
            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
            d=getche();
            goto choice;
            }
            case 4:
            {
            printf("\n\tBacon Supreme (Php290.00 each)\n\tHow many do you want?:\t");
            scanf("%d",&b);
            orig=290;
            vat=(b*orig)*.10;
            e=vat;
            pc=pc+b;
            f=b*orig;
            c=b*orig;
            total+=c;
            total_vat+=e;
            op+=f;
            printf("\n\tBacon Supreme = Php%.2f\n",c);
            printf("\n=============================================================================\n");
            printf("\n\n\t\t\t\tTotal price of your order=\tPhp%.2f",total);
            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
            d=getche();
            goto choice;
            }

            case 5:
            {
            drinks:
            printf("\n\tHere is our Drinks:\n\t\tPress (1) for Coke:\n\t\tPress (2) for Iced Tea:\n\t\tPress (3) for Mineral water:\n>");
            scanf("%d",&i);
                switch(i)
                {
                    case 1:
                    {
                    coke:
                    printf("\n\tYou choose COKE.\n\t\tPress (R) for Regular.\n\t\tPress (L) for Large.\n>");
                    d=getche();
                        switch(d)
                        {
                            case 'r': case'R':
                            {
                            printf("\n\tRegular Coke worth Php28.00\n\tHow many do you want?\n>");
                            scanf("%d",&b);
                            orig=28;
                            vat=(b*orig)*.10;
                            e=vat;
                            coker=coker+b;
                            f=b*orig;
                            c=b*orig;
                            total+=c;
                            total_vat+=e;
                            op+=f;
                            printf("\n\tOrder for Reg. Coke costs = Php%.2f.\n",c);
                            printf("\n=============================================================================\n");
                            printf("\n\n\t\t\t\tTotal =\tPhp%.2f",total);
                            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
                            d=getche();
                            goto choice;
                            }
                            case 'l': case 'L':
                            {
                            printf("\n\tLarge Coke worth Php39.00\n\tHow many do you want?.\n>");
                            scanf("%d",&b);
                            orig=39;
                            vat=(b*orig)*.10;
                            e=vat;
                            cokel=cokel+b;
                            f=b*orig;
                            c=b*orig;
                            total+=c;
                            total_vat+=e;
                            op+=f;
                            printf("\n\tOrder for Large Coke costs = Php%.2f.\n",c);
                            printf("\n=============================================================================\n");
                            printf("\n\n\t\t\t\tTotal =\tPhp%.2f",total);
                            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
                            d=getche();
                            goto choice;
                            }
                            default:
                            {
                            clrscr();
                            printf("\n\tPlease follow the instruction below\n");
                            goto coke;
                            }
                        }

                    case 2:
                    {
                    iced_tea:
                    printf("\n\tYou choose ICED TEA.\n\t\tPress (R) for Regular.\n\t\tPress (L) for Large.\n>");
                    d=getche();
                        switch(d)
                        {
                            case 'r': case 'R':
                            {
                            printf("\n\tRegular Iced Tea worth Php28.00\n\tHow many do you want?\n>");
                            scanf("%d",&b);
                            orig=28;
                            vat=(b*orig)*.10;
                            e=vat;
                            itr=itr+b;
                            f=b*orig;
                            c=b*orig;
                            total+=c;
                            total_vat+=e;
                            op+=f;
                            printf("\n\tOrder for Reg. Iced Tea costs = Php%.2f\n",c);
                            printf("\n=============================================================================\n");
                            printf("\n\n\t\t\t\tTotal =\tPhp%.2f",total);
                            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
                            d=getche();
                            goto choice;
                            }
                            case 'l': case 'L':
                            {
                            printf("\n\tLarge Iced Tea worth Php39.00\n\tHow many do you want?\n>");
                            scanf("%d",&b);
                            orig=39;
                            vat=(b*orig)*.10;
                            e=vat;
                            itl=itl+b;
                            f=b*orig;
                            c=b*orig;
                            total+=c;
                            total_vat+=e;
                            op+=f;
                            printf("\n\tOrder for Large Iced tea costs = Php%.2f\n",c);
                            printf("\n=============================================================================\n");
                            printf("\n\n\t\t\t\tTotal =\tPhp%.2f",total);
                            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
                            d=getche();
                            goto choice;
                            }
                            default:
                            {
                            clrscr();
                            printf("\n\tPlease look at the instruction below.\n");
                            goto iced_tea;
                            }
                        }
                    case 3:
                    {
                    mineral:
                    printf("\n\tYou choose MINERAL WATER.\n\t\tPress (R) for Regular.\n\t\tPress (L) for Large.\n>");
                    d=getche();
                        switch(d)
                        {
                            case 'r': case 'R':
                            {
                            printf("\n\tRegular Mineral worth Php20.00\n\tHow many do you want?\n>");
                            scanf("%d",&b);
                            orig=20;
                            vat=(b*orig)*.10;
                            e=vat;
                            minr=minr+b;
                            f=b*orig;
                            c=b*orig;
                            total+=c;
                            total_vat+=e;
                            op+=f;
                            printf("\n\tOrder for Reg. Mineral costs = Php%.2f\n",c);
                            printf("\n=============================================================================\n");
                            printf("\n\n\t\t\t\tTotal =\tPhp%.2f",total);
                            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
                            d=getche();
                            goto choice;
                            }
                            case 'l': case 'L':
                            {
                            printf("\n\tLarge Mineral worth Php27.00\n\tHow many do you want?\n>");
                            scanf("%d",&b);
                            orig=27;
                            vat=(b*orig)*.10;
                            e=vat;
                            minl=minl+b;
                            f=b*orig;
                            c=b*orig;
                            total+=c;
                            total_vat+=e;
                            op+=f;
                            printf("\n\tOrder for Large Mineral costs = Php%.2f\n",c);
                            printf("\n=============================================================================\n");
                            printf("\n\n\t\t\t\tTotal =\tPhp%.2f",total);
                            printf("\n\n\tWould you like to make another order?\n\n\t\t(Y) for YES.\n\t\t(N) for NO.\n\t\tYour choice: ");
                            d=getche();
                            goto choice;
                            }
                            default:
                            {
                            clrscr();
                            printf("\n\tPlease look at the instruction below.\n");
                            goto mineral;
                            }
                        }
                    break;}
                }
            break;}
            default:
            {
            clrscr();
            printf("\n\tPlease follow the instruction below.");
            goto drinks;
        }
    }
}
}
getche();
}

Recommended Answers

All 8 Replies

line 45. declaration error

Nesting functions is not supported in C++.

You probably missed a curly brace somewhere. This is not that hard to happen in about 400 lines of poorly indented code.
It is of utmost(at least that is what I think) importance to structure your code well by chopping it into smaller chunks if possible. E.g. put your many printf displays into separate functions. Use consistent indentation. Etc.

what will i remove sir?

You see the { on line 16? It marks the beginning of your function main. Where is the } that marks the end of that function? (Hint; nowhere - you need to put it in).

You need to implement the order() function (and others) outside of main(). Java let's you implement functions inside others, but not in C or C++.

Also, please don't ask us to analyize 400+ lines of code. That is just disrepectful of our time and efforts.

Hi
I wanted just to mention that "void main ()" won't be accepted by all compilers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.