Sunday 3 March 2013

Seat Reservation program in c++

  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"
program is the following
 
     #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<<"already reserverd for another cutomer\n";
    getch();
    }
   

0 comments:

Post a Comment