Вы находитесь на странице: 1из 5

#include <iostream>

using namespace std;

int main()

int c;

const int SEATS = 30; //total seats

int plane[ SEATS ] = { 0 }, people = 0, row1 = 1, row2= 6,select; //constants declaration

char r;

cout<<"\n\n\n !!!!______Wellcome to Cineplex Cinema______!!!!\n\n\n\n";

cout<<"Today the movies that will be shown are following\n1. The Pursuit of happyness\n2. The
man who knew infinity\n3. The secret life of modern living algorithms\n4. Good will be
hunting"<<endl;

cout<<"Enter your choice of movie\n"<<endl;

cin>>c;

if(c==1) //choice of selecting a movie

cout<<"You selected the movie, The pursuit of happyness"<<endl;

else

if(c==2)

cout<<"You selected the movie, The man who knew infinity"<<endl;

else

if(c==3)

cout<<"You selected the movie, Gladiator"<<endl;

else

if(c==4)

cout<<"You selected the movie, Good will be hunting"<<endl;

while ( people <= 30 ) { // loop to reserve seats


cout << "\nPlease press 1 for seat row 1\n"

<< "Please press 2 for seat row 2\n";

cout<<"Enter your choice > ";

cin>>select;

if ( select == 1 )

if ( !plane[ row1 ] && row2 <= 30 ) //condition that shows that seats are not
reserved

cout << "Your seat assignment is \a" << row1 << ' '; // a seat is reserved

plane[ row1++ ] = 1;

++people; // an increment to next seat

cout<<"\n_____________________________________________\n";
}

else if ( row1 >= 30 && row2 <= 5 ) { //condition that shows 1st row is full

cout << "\n\nThe 1st row is full.\n"

<< "Would you like to sit in the 2nd row???"

<< " section (Y or N)? ";

cout<<"\nEnter your choice > ";

cin >> r;

if ( toupper( r ) == 'Y' ) // choice of sitting in 2nd row

//toupper will convert y into Y

cout << "Your seat assignment is\a " << row2<< ' ';

plane[ row2++ ] = 1;

++people;

else

// if all the seats are reserved

cout << "Next movie in 5 hours.\n";


}

else

cout << "Next movie in 5 hours.\n";

else {

if ( !plane[ row2 ] && row2 <= 5 ) {

cout << "Your seat assignment is\a " << row2 << '\n';

plane[ row2++ ] = 1;

++people;

else if ( row2 > 5 && row1<= 30 ) {

cout << "\n\nThe 2nd row is full.\n"

<< "Would you like to sit in the 1st row???"

<< " section (Y or N)? ";

cout<<"\,Enter your choice > ";

cin >> r;

if ( toupper( r ) == 'Y' ) {
cout << "Your seat assignment is\a " << row1 << '\n';

plane[ row1++ ] = 1;

++people;

else

cout << "Next movie in 5 hours.\n";

else

cout << "Next movie in 5 hours.\n";

cout << "\n\nAll seats for this movie are sold."<< endl;

return 0;

Вам также может понравиться