Write a program to book movie tickets online.
Use File Handling and inheritance concept, and other c++ logics.
The Output should include:
1)Available Movies
2)book ticket
(select movie, select time, pay and get seat number)
3)Cancel ticket
(enter seat number to cancel)
4)Show record
5)Exit
#include<iostream>
#include<stdio.h>
using namespace std;
class Movies
{
string avb; int tm;int pay;int seat;
public:
void Available(){
cout<<"\nEnter the name of Available movies: ";
cin>>avb;
}
void bookTicket()
{//select movie, select time, pay and get seat number
cout<<"\n select movie: ";
cin>>avb;
cout<<"\n enter time ";
cin>>tm;
cout<<"\nenter pay ";
cin>>pay;
cout<<"\n enter seat number ";
cin>>seat;
}
void CancelTic()
{
cout<<"\n enter seat number ";
cin>>seat;
}
void showRecs()
{
cout<<"\n Available movies"<<avb;
}
};
int main()
{
Movies m;
int ch;
do
{
cout<<"\n1. Available";
cout<<"\n2. Book ticket";
cout<<"\n3. Cancel ticket";
cout<<"\n4. Show records\n";
cout<<"\n5. Exit\n";
cout<<"\nEnter the choice :: ";
cin>>ch;
switch (ch)
{
case 1:
m.Available();
break;
case 2:
m.bookTicket();
break;
case 3:
m.CancelTic();
break;
case 4:
m.showRecs();
break;
case 5:
break;
}
} while (ch!=5);
}
Comments
Leave a comment