Tuesday 13 August 2019

SE COMP A.Y 2019-20 GROUP B CINEMAX ASSIGNMENT MODIFIED


//============================================================================
// Name        : cinemax.cpp
// Author      : NitinShivale
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

class cinemax
{
    cinemax *next;
    cinemax *prev;
    cinemax *rows[10];  //data members
    string mname;
    long mobno;
    int flag;
    int seatno;
public:
    cinemax() //constructor..to initialize the data memeber and rows array.
    {
     flag=0;
     mobno=0;
     seatno=0;
     next=prev=NULL;
     for(int i=0;i<10;i++)
     {
       rows[i]=NULL;
     }
    }
    void show();
    void showSeat();        //member Functions
    void createTheater();
}; //end of class

//This show() function only displays the status of rows i:e Array of pointer.
void cinemax::show()
{
 for(int i=0;i<10;i++)
 {
  cout<<"|"<<rows[i]<<"|-> "<<"\n\n";
 }
}

//This showSeat() function displays the memory map of theater after creation of theater...
void cinemax::showSeat()
{
 cinemax *temp;
 for(int i=0;i<10;i++)
 {
  cout<<"|"<<rows[i]<<"|-> ";
  temp=rows[i];
  for(int j=0;j<7;j++)
  {
   cout<<"|"<<temp->prev<<"|"<<temp->seatno<<"|"<<temp->flag<<"|"<<temp->mname<<"|"<<temp->mobno<<"|"<<temp->next<<"|<-->";
   temp=temp->next;
  }
  cout<<"\n\n";
 }
}

//This createTheater() function creates the 10 rows and 7 seats of Theater by using Doubly Circular Linked List.
void cinemax::createTheater()
{
    cinemax *p,*temp,*head,*p1;
    head=p=p1=temp=NULL;
    int i,j;
    //code for to create the ten rows....

    for(i=0;i<10;i++)
    {
     p=new cinemax;
     p->flag=0;
     p->seatno=1;
     p->mname="NULL"; //code belongs to first node of each row
     p->mobno=0;
     p->next=p;
     p->prev=p;
     rows[i]=p;
     temp=p;
     head=temp;
     //code for to create six seats....
     for(j=1;j<7;j++)
     {
      p1=new cinemax;
      p1->flag=0;
      p1->seatno=j+1;
      p1->mname="NULL"; //assuming that flag zero, mob no zero and movie name i:e mname NULL means seat is not booked yet..initial state of seat.
      p1->mobno=0;
      p1->next=temp->next;
      p1->prev=temp;
      temp->next=p1;
      head->prev=p1;
      temp=p1;
     }
    }
}

//The program execution starts from main() function.
int main() {
    cout << "!!!Welcome To Cinemax Theater!!!" << endl;
    cinemax c1; //object c1 creation of cinemax theater to call all the member functions.
    int ch;
    do
    {
        cout<<"1.Show Rows Status Before Creation of Theater\n"; //Menu for user to display and operate accordingly..
        cout<<"2.Show Rows Status After Creation of Theater\n";
        cout<<"3.Show Memory Map of Seats after Creation of 10 Rows and Seven Seats..:\n";
        cout<<"4.Show Seat Vacancy in Theater...\n";
        cout<<"5.Book My Show..\n";
        cout<<"6.Cancel My Show...\n";
        cout<<"\nEnter your Choice...: ";
        cin>>ch;
        switch(ch)
        {
         case 1:cout<<"\n\nBefore Creation of Theater...\n";
                c1.show();
                break;
         case 2:c1.createTheater(); //member function calling
                cout<<"\n\nAfter Theater Creation...\n";
                c1.show();
                break;
         case 3:cout<<"\n After Seat creation of Theater....\n";
                c1.showSeat();
                break;
         case 4:cout<<"/* under process */\n";break;
         case 5:cout<<"/* under process */\n";break;
         case 6:cout<<"/* under process */\n";break;
        }//end of switch case

    }while(ch!=7); //end of do while loop.
    cout<<"\n\n Thank You so much Visit Again....\n";
 return 0;
}//end of main() function


/** ========  OUTPUT OF CINEMAX THEATER  =======================
 *!!!Welcome To Cinemax Theater!!!
1.Show Rows Status Before Creation of Theater
2.Show Rows Status After Creation of Theater
3.Show Memory Map of Seats after Creation of 10 Rows and Seven Seats..:
4.Show Seat Vacancy in Theater...
5.Book My Show..
6.Cancel My Show...

Enter your Choice...: 1


Before Creation of Theater...
|0|->

|0|->

|0|->

|0|->

|0|->

|0|->

|0|->

|0|->

|0|->

|0|->

1.Show Rows Status Before Creation of Theater
2.Show Rows Status After Creation of Theater
3.Show Memory Map of Seats after Creation of 10 Rows and Seven Seats..:
4.Show Seat Vacancy in Theater...
5.Book My Show..
6.Cancel My Show...

Enter your Choice...:2

After Theater Creation...
|0xd48010|->

|0xd484e0|->

|0xd489b0|->

|0xd48e80|->

|0xd49350|->

|0xd49820|->

|0xd49cf0|->

|0xd4a1c0|->

|0xd4a690|->

|0xd4ab60|->

1.Show Rows Status Before Creation of Theater
2.Show Rows Status After Creation of Theater
3.Show Memory Map of Seats after Creation of 10 Rows and Seven Seats..:
4.Show Seat Vacancy in Theater...
5.Book My Show..
6.Cancel My Show...

Enter your Choice...: 3

Enter your Choice...: 3

 After Seat creation of Theater....
|0xd48010|-> |0xd48430|1|0|NULL|0|0xd480c0|<-->|0xd48010|2|0|NULL|0|0xd48170|<-->|0xd480c0|3|0|NULL|0|0xd48220|<-->|0xd48170|4|0|NULL|0|0xd482d0|<-->|0xd48220|5|0|NULL|0|0xd48380|<-->|0xd482d0|6|0|NULL|0|0xd48430|<-->|0xd48380|7|0|NULL|0|0xd48010|<-->

|0xd484e0|-> |0xd48900|1|0|NULL|0|0xd48590|<-->|0xd484e0|2|0|NULL|0|0xd48640|<-->|0xd48590|3|0|NULL|0|0xd486f0|<-->|0xd48640|4|0|NULL|0|0xd487a0|<-->|0xd486f0|5|0|NULL|0|0xd48850|<-->|0xd487a0|6|0|NULL|0|0xd48900|<-->|0xd48850|7|0|NULL|0|0xd484e0|<-->

|0xd489b0|-> |0xd48dd0|1|0|NULL|0|0xd48a60|<-->|0xd489b0|2|0|NULL|0|0xd48b10|<-->|0xd48a60|3|0|NULL|0|0xd48bc0|<-->|0xd48b10|4|0|NULL|0|0xd48c70|<-->|0xd48bc0|5|0|NULL|0|0xd48d20|<-->|0xd48c70|6|0|NULL|0|0xd48dd0|<-->|0xd48d20|7|0|NULL|0|0xd489b0|<-->

|0xd48e80|-> |0xd492a0|1|0|NULL|0|0xd48f30|<-->|0xd48e80|2|0|NULL|0|0xd48fe0|<-->|0xd48f30|3|0|NULL|0|0xd49090|<-->|0xd48fe0|4|0|NULL|0|0xd49140|<-->|0xd49090|5|0|NULL|0|0xd491f0|<-->|0xd49140|6|0|NULL|0|0xd492a0|<-->|0xd491f0|7|0|NULL|0|0xd48e80|<-->

|0xd49350|-> |0xd49770|1|0|NULL|0|0xd49400|<-->|0xd49350|2|0|NULL|0|0xd494b0|<-->|0xd49400|3|0|NULL|0|0xd49560|<-->|0xd494b0|4|0|NULL|0|0xd49610|<-->|0xd49560|5|0|NULL|0|0xd496c0|<-->|0xd49610|6|0|NULL|0|0xd49770|<-->|0xd496c0|7|0|NULL|0|0xd49350|<-->

|0xd49820|-> |0xd49c40|1|0|NULL|0|0xd498d0|<-->|0xd49820|2|0|NULL|0|0xd49980|<-->|0xd498d0|3|0|NULL|0|0xd49a30|<-->|0xd49980|4|0|NULL|0|0xd49ae0|<-->|0xd49a30|5|0|NULL|0|0xd49b90|<-->|0xd49ae0|6|0|NULL|0|0xd49c40|<-->|0xd49b90|7|0|NULL|0|0xd49820|<-->

|0xd49cf0|-> |0xd4a110|1|0|NULL|0|0xd49da0|<-->|0xd49cf0|2|0|NULL|0|0xd49e50|<-->|0xd49da0|3|0|NULL|0|0xd49f00|<-->|0xd49e50|4|0|NULL|0|0xd49fb0|<-->|0xd49f00|5|0|NULL|0|0xd4a060|<-->|0xd49fb0|6|0|NULL|0|0xd4a110|<-->|0xd4a060|7|0|NULL|0|0xd49cf0|<-->

|0xd4a1c0|-> |0xd4a5e0|1|0|NULL|0|0xd4a270|<-->|0xd4a1c0|2|0|NULL|0|0xd4a320|<-->|0xd4a270|3|0|NULL|0|0xd4a3d0|<-->|0xd4a320|4|0|NULL|0|0xd4a480|<-->|0xd4a3d0|5|0|NULL|0|0xd4a530|<-->|0xd4a480|6|0|NULL|0|0xd4a5e0|<-->|0xd4a530|7|0|NULL|0|0xd4a1c0|<-->

|0xd4a690|-> |0xd4aab0|1|0|NULL|0|0xd4a740|<-->|0xd4a690|2|0|NULL|0|0xd4a7f0|<-->|0xd4a740|3|0|NULL|0|0xd4a8a0|<-->|0xd4a7f0|4|0|NULL|0|0xd4a950|<-->|0xd4a8a0|5|0|NULL|0|0xd4aa00|<-->|0xd4a950|6|0|NULL|0|0xd4aab0|<-->|0xd4aa00|7|0|NULL|0|0xd4a690|<-->

|0xd4ab60|-> |0xd4af80|1|0|NULL|0|0xd4ac10|<-->|0xd4ab60|2|0|NULL|0|0xd4acc0|<-->|0xd4ac10|3|0|NULL|0|0xd4ad70|<-->|0xd4acc0|4|0|NULL|0|0xd4ae20|<-->|0xd4ad70|5|0|NULL|0|0xd4aed0|<-->|0xd4ae20|6|0|NULL|0|0xd4af80|<-->|0xd4aed0|7|0|NULL|0|0xd4ab60|<-->

1.Show Rows Status Before Creation of Theater
2.Show Rows Status After Creation of Theater
3.Show Memory Map of Seats after Creation of 10 Rows and Seven Seats..:
4.Show Seat Vacancy in Theater...
5.Book My Show..
6.Cancel My Show...

Enter your Choice...: 4

Enter your Choice...: 4
*** under process  ****
1.Show Rows Status Before Creation of Theater
2.Show Rows Status After Creation of Theater
3.Show Memory Map of Seats after Creation of 10 Rows and Seven Seats..:
4.Show Seat Vacancy in Theater...
5.Book My Show..
6.Cancel My Show...

Enter your Choice...: 5
*** under process  ****
1.Show Rows Status Before Creation of Theater
2.Show Rows Status After Creation of Theater
3.Show Memory Map of Seats after Creation of 10 Rows and Seven Seats..:
4.Show Seat Vacancy in Theater...
5.Book My Show..
6.Cancel My Show...

Enter your Choice...: 6
*** under process  ****
1.Show Rows Status Before Creation of Theater
2.Show Rows Status After Creation of Theater
3.Show Memory Map of Seats after Creation of 10 Rows and Seven Seats..:
4.Show Seat Vacancy in Theater...
5.Book My Show..
6.Cancel My Show...

Enter your Choice...: 7

Thank You so much Visit Again....

 *************************************************************************************************/

data structures and algorithms Web Developer

No comments:

Post a Comment