excuse me,
can somebody help me to make a simple program that combine an array,function and pointer..
please...
i'm already confuse about C++.
please...
thank you!

Could you give us more information about what you need, and what you already know how to do? The problem description is rather sparse, at best. Do you have anything in particular in mind as far as what the program should do?

A few questions to get things going:
* Do you know how to write a function, and how to call one? Can you give a simple example of one?
* Do you understand what a pointer is, and what an array is, and what each is used for?
* Do you know how to declare each of them?
* Do you understand the differences between an array variable and a pointer to an array, when they can be interchanged and when they can't?
* Do you know how to combine each of these into a working function?

#include<iostream.h>

void intro()
{
    cout<<"\3\3\3\3\3\3\3\3 WELCOME \3\3\3\3\3\3\3\3\n\n";
}

void seat()
{
    int seatnumber;

    cout<<"\n********************************************\n";
        cout<<"           OUR MOVIE HAS 10 SEAT\n";
        cout<<"********************************************\n";
        cout<<endl;

        int j,k,seat[2][5]={{1,2,3,4,5},{6,7,8,9,10}};

        for(j=0;j<2;j++)
            for(k=0;k<5;k++)
        {
            cout<<"seat["<<j<<"]["<<k<<"]:"<<seat[j][k];
            cout<<endl;
        }

        cout<<"\nPlease choose your seat:";
        cin>>seatnumber;

        if(seatnumber>0&&seatnumber<11)
        {
        cout<<"Seat is available!\n";
        }

        else
        {
        cout<<"Not available!\n";
        }

        cout<<"----------------------------------------------------\n";
}

void main()
{
    int movie;

    for(int i=0;i<10;i++)
    {

    intro();

    cout<<"TYPES OF MOVIE \t TIME \t PRICE(RM) \n";
    cout<<"1.BATMAN \t 3pm \t 8\n";
    cout<<"2.ULTRAMAN \t 4pm \t 8\n";
    cout<<"3.SPIDERMAN \t 5pm \t 8\n\n";

        cout<<"Please choose number of movie:";
        cin>>movie;
        switch(movie)
        {
        case 1:cout<<"\nBATMAN \t 3pm \t RM8\n";
            break;
        case 2:cout<<"\nULTRAMAN \t 4pm \t RM8\n";
            break;
        case 3:cout<<"\nSPIDERMAN \t 5pm \t RM8\n\n";
            break;
        default:cout<<"Wrong Input!\n";
        }
        seat();
    }
}

*do you know how to add a pointer in this program?

Yes, but it isn't clear why you would need to - it seems to work well enough as it is (modulo a few issues). What other functionality does the program need which would require pointers?

A few things I did note that could cause problems. First off, you have a function named seats(), and inside that function you have a variable seats[][]. While it may not be causing a problem, it is a name collision and you would be well advised to rename one of the two. I would call the function seating() or something like that.

Second, you declare main() as type void, which is incorrect; in C++, main() should always return type int. Don't forget to add a return 0; at the end of main() as well.

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.