hello guys !
I need some help..

"assume that the process happen in some restaurant.
there are seat1 until seat10 in the restaurant.
the customer(user) need to enter the seat number to select the seat that they want.
the seat that have been selected by customer will remark by 'reserved' and the other seat that has not been selected yet will become 'available'.
the program will be repeated until seat1 until seat10 are complete selected by customer"

how can I build this program.
am I have to loop the program until 10 times?
how can the code is being?
please help me :'(
thank you.

*the program will be repeated until seat1 to seat10 are complete selected by customer"

Welcome to programming. Programming is the art, craft and sometimes science of thinking about problems in such a way that the solution lends itself to a programmatical representation. All the rest is just learning syntax.

I'll repeat that more simply; programming is thinking. So you need to think about the problem.

How would you do this on paper? Serious question. If I asked you to keep track of ten seats on a piece of paper, and I then tell you seat numbers that people want to reserve, how would you keep track of which seats have been reserved and which have not?

thank you Moschops.
actually I have already done do it on a piece of paper.
but I do not really know how to transform the process in the form of C++ coding.

U can use recursive functions to help u further

Here is a summary of how you may have done it on paper:

Make a grid of ten spaces - each space represents one seat.
Put a mark in a space when it is reserved.

Now thinking about how to represent this in code:

Making a grid on paper - this is screaming out to be an array of size ten.
Put a mark in a space when it is reserved - when a seat is reserved, change the value. For example, you might decide that zero means not reserved and one means reserved.

Do you know what an array is?
Do you know how to set the value of something in C++? (Hint: use the = symbol)
Do you know how to read the value of something in C++?

commented: Very helpfull comments! +14

tanya1997,
recursive functions?

Moschops,
sorry.
actually i'm new in programming.
so i am not really understand how to use an array.

so i am not really understand how to use an array.

Self-teaching is an important skill that every programmer should posses.
"How to use an array" can be interpreted in several ways. You should clarify on that.
What in specific are you encountering trouble with? Is it the array syntax or do you feel that you don't understand the concept well?
Have you done some searching about the topic already?
Since it would be cumbersome to collect all advice regarding arrays and their syntax in one post, I strongly suggest you do a Google search first.
There's plenty of information and examples of arrays and their usage on the Internet, more than one could cover in a single post.
Then if you've done that, and you've got a specific question about some topic, feel free to ask.

Good luck ;-)

commented: Very helpfull! +14
commented: Exactly +6
#include <iostream>
#include <conio>
int arr[10];
main()
{
int i,n;
cout <<"First enter the number for each seat"<<endl;
for(i=1;i<=10;i++)
{
cout<<"Enter  the  number for seat"<<i<<endl;
cin>>arr[i];
}
 for(i=1;i<=10;i++)
 {
  cout <<"Your number for seat"<<i<<"\tReserved"<<arr[i]<<endl;
}
cout<<"customer request for seat number?\t";cin>>n;

for(i=1;i<=10;i++)
{
if(n==arr[i])
{
 n=arr[i];
}


}
cout <<"Sorry dear customer this seat"<<i<<"\talready reserverd for another cutomer\n";
getch();
}

this program require borland c++...thanks if you any question then reply me

do easily...

commented: Really?! -3

One fairly easy to understand, online, reference, is cplusplus.com. It includes a pretty good search engine that will search the forum and the reference.

Here's a bit of code to get you started. This shows you a sample on initializing an array, and also a simple menu. I left the individual sub routines for you, but this should be able to get you started. I'm fairly certain that this snippet is portable. It shouldn't matter which machine, OS, compiler or IDE you're using, as long as your using the standard library it should work. I would recommend staying with the standard library, you don't want to use a library you're instructor doesn't have. He/She may fail you just because it doesn't work on his/her machine, or at the very least tell you to redo it.

One advantage to using a menu system like this, is changing the options is fairly simple. For instance, if you wanted an option for the user to cancel a reservation, include the option in the menu, and add the appropriate sub routine.

#include <iostream>
using namespace std;
char Seats[10] = {'A','A','A','A','A','A','A','A','A','A'};
char Cancel = 'A';
char Reserve= 'R';
void DisplaySeating();
void ChooseSeat();
int main()
{
    int MenuChoice = 1;
    while(MenuChoice != 0)
    {
        cout << "\tMain Menu" << endl;
        DisplaySeating();
        cout << "1. Reserve Seat"<< endl<< "2. Display Seating" << endl << "0. Quit" << endl << "Menu Choice: ";
        cin >> MenuChoice;
        cout << endl;
        switch (MenuChoice)
        {
        case 1:
            ChangeSeat();
            break;
        case 2:
            DisplaySeating();
            break;
        case 0:
            break;
        default:
            cout << "Choose only a displayed option please"<< endl;
        }
    }

    return 0;
}
void ChangeSeat()
{
    //Insert code to change the status of the seat depending on the menu choice.  
    //Make sure to check for valid input, and also whether to seat needs to change
}

void DisplaySeating()
{
    //Insert code to display the status of each seat.

}
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.