hi,
i have a small problem with my program:

int main(int argc, char *argv[])
{
    int ende;
    int modus;
    short x;
    short y;

    mkdir("maps");
    while(1==1)

    {
        cls();
        //some printf's

        char enter=0;                                                             
        while (enter != '\r' && enter != '\n') { enter = getchar(); }             

        system("cls");                                                            

        ende=0;
        modus=0;



        //some printf's

        scanf("%d",&modus);fflush(stdin);

        if(modus==1) //singelplayer
        {
            tttsp();
        }
        else if(modus==2) //multiplayer:
        {
            tttmp();
        }
        else if(modus==3)//Snake
        {
            snake();
        }
        else if(modus==4) //snake editor
        {
            editor();
        }
        else
        {
            printf("Kein Gueltiger Modus ausgewählt!\n");
            system("PAUSE");
            cls();
        }
    }
    system("PAUSE");
    return 0;
}

when i want to compile the program, there is the follow error:

expected declaration or statement at end of input

Can someone help me with my problem?

Recommended Answers

All 3 Replies

When you remove your printfs, does this STILL not compile?

The problem could be line 15: many older compilers don't like declaring variabes anywhere except at the beginning of a block enclosed in { and }. That's ok with c++, but not C.

Thank you. I've tried both and everything is the same :( have you other tips?

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.