Movie Reservation Program Project
Movie Reservation Program Project
#
#
#
#
#
#
include
include
include
include
include
include
include
<fstream.h>
<conio.h>
<dos.h>
<process.h>
<stdio.h>
<graphics.h>
<string.h>
void graph()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
}
int xco,yco;
char str[30];
void setposition(int x, int y)
{
xco=x; yco=y;
}
n_a[40];
n_ac[40];
n_d[40];
n_o[100];
class hall
{
protected:
cast c;
float t;
char grade[2];
public:
char name[100];
void input();
void display();
void f_display();
};
void hall::input()
{
cout<<"ENTER THE NAME OF THE FILM:";
gets(name);
cout<<"ENTER ACTOR NAME:";
gets(c.n_a);
cout<<"ENTER ACTRESS NAME:";
gets(c.n_ac);
cout<<"ENTER DIRECTOR NAME:";
gets(c.n_d);
cout<<"ENTER OTHERS:";
gets(c.n_o);
cout<<"ENTER THE GRADE GIVEN TO FILM BY CENSOR BOARD:";
gets(grade);
cout<<"ENTER THE TIME LIMIT OF FILM:";
cin>>t;
}
void hall::display()
{
clrscr();
puts(name);
cout<<"\n\t*******";
cout<<"\n\tCASTING";
cout<<"\n\t*******";
cout<<"\nACTOR NAME :\t\t\t";
puts(c.n_a);
cout<<"ACTRESS NAME :\t\t\t";
puts(c.n_ac);
cout<<"DIRECTOR NAME :\t\t\t";
puts(c.n_d);
cout<<"OTHERS :\t\t\t";
puts(c.n_o);
cout<<"GRADE GIVEN(BY CENSOR BOARD) :\t";
puts(grade);
cout<<"TIME LIMIT OF FILM :\t\t";
cout<<t;
}
void hall::f_display()
{
clrscr();
graph();
cleardevice();
int size=8,style=GOTHIC_FONT;
graph();
settext("CINEMA");
settextstyle(style,HORIZ_DIR,size);
setposition(0,22);
moveto(xco,yco);
setcolor(BLUE);
//setbkcolor(BLUE);
outtext(str);
settext("COMPLEX");
settextstyle(style,HORIZ_DIR,size);
setposition(0,122);
moveto(xco,yco);
outtext(str);
int s=4,st=TRIPLEX_FONT;
settext(name);
settextstyle(st,HORIZ_DIR,s);
setposition(0,300);
moveto(xco,yco);
setcolor(RED);
outtext(str);
setcolor(4);
setfillstyle(4,RED);
bar3d(425,-10,700,500,1,1);
bar3d(430,-10,700,500,1,1);
bar3d(435,-10,700,500,1,1);
bar3d(440,-10,700,500,1,1);
bar3d(445,-10,700,500,1,1);
bar3d(450,-10,700,500,1,1);
}
class seats:public hall
{
public:
int bal;
int lower;
int upper;
seats()
{
bal=lower=upper=0;
}
void b_reserve(int num);
void u_reserve(int num);
void l_reserve(int num);
void reserve(int num);
void b_cancel(int num);
void u_cancel(int num);
void l_cancel(int num);
~seats()
{
}
};
void seats::reserve(int num)
{
graph();
cleardevice();
int i,j,k,l,m,n;
setcolor(8);
setfillstyle(8,BLUE);
bar3d(425,-10,700,500,1,1);
i=50,j=40,k=100,l=55;
for(j=40,l=55;j<=450,l<=465;j+=30,l+=30)
{
for(i=50,k=100;i<=330,k<=400;i+=70,k+=70)
{
bar3d(i,j,k,l,1,1);
}
}
int s=0;
gotoxy(55,10);
s=num;
int w=0;
for(j=40,l=55;j<=450,l<=465;j+=30,l+=30)
{
for(i=50,k=100;i<=330,k<=400;i+=70,k+=70)
{
w+=1;
if(w>=s+1)
{
break;
}
setcolor(2);
setfillstyle(2,2);
bar3d(i,j,k,l,1,1);
}
}
}
void seats::b_reserve(int num)
{
reserve(bal);
if((bal+num)<=70)
{
bal+=num;
closegraph();
clrscr();
reserve(bal);
gotoxy(55,10);
cout<<"***************";
gotoxy(55,11);
cout<<" RESERVATION";
gotoxy(55,12);
cout<<" COMPLETED";
gotoxy(55,13);
cout<<"***************";
gotoxy(55,16);
cout<<"AMOUNT TO BE PAID";
gotoxy(56,17);
cout<<"Rs."<<num*120;
getch();
}
else
{
clrscr();
closegraph();
reserve(bal);
gotoxy(55,11);
cout<<" CANNOT";
gotoxy(55,12);
cout<<" RESERVE";
getch();
}
closegraph();
}
void seats::u_reserve(int num)
{
reserve(upper);
if((upper+num)<=70)
{
upper+=num;
closegraph();
clrscr();
reserve(upper);
gotoxy(55,10);
cout<<"***************";
gotoxy(55,11);
cout<<" RESERVATION";
gotoxy(55,12);
cout<<" COMPLETED";
gotoxy(55,13);
cout<<"***************";
gotoxy(55,16);
cout<<"AMOUNT TO BE PAID";
gotoxy(56,17);
cout<<"Rs."<<num*80;
getch();
}
else
{
clrscr();
closegraph();
reserve(upper);
gotoxy(55,11);
cout<<" CANNOT";
gotoxy(55,12);
cout<<" RESERVE";
getch();
}
closegraph();
}
void seats::l_reserve(int num)
{
reserve(lower);
if((lower+num)<=70)
{
lower+=num;
closegraph();
clrscr();
reserve(lower);
gotoxy(55,10);
cout<<"***************";
gotoxy(55,11);
cout<<" RESERVATION";
gotoxy(55,12);
cout<<" COMPLETED";
gotoxy(55,13);
cout<<"***************";
gotoxy(55,16);
cout<<"AMOUNT TO BE PAID";
gotoxy(56,17);
cout<<"Rs."<<num*20;
getch();
}
else
{
clrscr();
closegraph();
reserve(lower);
gotoxy(55,11);
cout<<" CANNOT";
gotoxy(55,12);
cout<<" RESERVE";
getch();
}
closegraph();
}
else
{
clrscr();
closegraph();
reserve(lower);
gotoxy(55,11);
cout<<" CANNOT";
gotoxy(55,12);
cout<<" CANCEL";
getch();
}
closegraph();
}
void seats::u_cancel(int num)
{
reserve(upper);
if((upper-num)>=0)
{
upper-=num;
closegraph();
clrscr();
reserve(upper);
gotoxy(55,10);
cout<<"***************";
gotoxy(55,11);
cout<<" CANCELATION";
gotoxy(55,12);
cout<<" COMPLETED";
gotoxy(55,13);
cout<<"***************";
gotoxy(55,16);
cout<<"TICKET AMOUNT ";
gotoxy(56,17);
cout<<"Rs."<<num*20;
getch();
}
else
{
clrscr();
closegraph();
reserve(upper);
gotoxy(55,11);
cout<<" CANNOT";
gotoxy(55,12);
cout<<" CANCEL";
getch();
}
closegraph();
}
void main()
{
clrscr();
hall h1;
seats s;
int ch,c,num;
char d,e;
char h;
h='y';
fstream f;
f.open("cinema.dat",ios::in|ios::out|ios::app|ios::binary);
ch=1;
while(ch==1||ch==2||ch==3||ch==4||ch==5)
{
clrscr();
closegraph();
s.f_display();
gotoxy(58,10);
cout<<"MAIN MENU";
gotoxy(58,11);
cout<<"*********";
gotoxy(58,11);
cout<<"1)ABOUT FILM";
gotoxy(58,13);
cout<<"2)RESERVATION";
gotoxy(58,15);
cout<<"3)CANCELLATION";
gotoxy(58,17);
cout<<"4)AMOUNT COLLECTED";
gotoxy(58,18);
cout<<"ANY OTHER TO QUIT";
gotoxy(58,19);
cout<<"ENTER CHOICE:";
cin>>ch;
switch(ch)
{
case 1:
{
closegraph();
clrscr();
s.input();
f.close();
gotoxy(58,10);
cout<<"FILM MENU";
gotoxy(58,11);
cout<<"*********";
gotoxy(58,13);
cout<<"1)CHANGE FILM";
gotoxy(58,14);
cout<<"2)DISPLAY FILM";
s.display();
gotoxy(58,15);
cout<<"ANY OTHER TO RETURN";
gotoxy(58,16);
cout<<"ENTER CHOICE:";
cin>>c;
}
switch(c)
{
case 1: closegraph();
s.input();
f.write((char*)&s,sizeof(hall));
f.close();
break;
case 2: clrscr();
closegraph();
f.read((char*)&s,sizeof(hall));
s.display();
getch();
f.close();
break;
case 3: break;
}
break;
case 2: d=1;
while(d==1||d==2||d==3)
{
closegraph();
clrscr();
s.f_display();
gotoxy(58,10);
cout<<"RESERVATION";
gotoxy(58,11);
cout<<"*************";
gotoxy(58,13);
cout<<"1)FOR BALCONY";
gotoxy(58,14);
cout<<"2)FOR UPPERSTALL";
gotoxy(58,15);
cout<<"3)FOR LOWERSTALL";
gotoxy(58,16);
cout<<"ANY OTHER TO RETURN";
gotoxy(58,17);
cout<<"ENTER CHOICE:";
cin>>d;
switch(d);
{
case '1':h='y';
while(h=='y'||h=='Y')
{
clrscr();
closegraph();
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.bal);
gotoxy(58,16);
cout<<"HOW MANY:";
cin>>num;
s.b_reserve(num);
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.bal);
gotoxy(58,18);
cout<<"RESERVE MORE(Y/N):";
cin>>h;
}
closegraph();
clrscr();
break;
case '2': h='y';
while(h=='y'||h=='Y')
{
clrscr();
closegraph();
s.reserve(s.upper);
gotoxy(58,16);
cout<<"HOW MANY:";
cin>>num;
s.u_reserve(num);
s.reserve(s.upper);
gotoxy(58,18);
cout<<"RESERVE MORE(Y/N):";
cin>>h;
}
closegraph();
clrscr();
break;
case '3': h='y';
while(h=='y'||h=='Y')
{
clrscr();
closegraph();
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.lower);
gotoxy(58,16);
cout<<"HOW MANY:";
cin>>num;
s.l_reserve(num);
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.lower);
gotoxy(58,18);
cout<<"RESERVE MORE(Y/N):";
cin>>h;
}
closegraph();
clrscr();
break;
}
}
break;
case 3 : e=1;
while(e==1||e==2||e==3)
{
closegraph();
clrscr();
s.f_display();
gotoxy(58,10);
cout<<"CANCELLATION";
gotoxy(58,11);
cout<<"*************";
gotoxy(58,13);
cout<<"1)FOR BALCONY";
gotoxy(58,14);
cout<<"2)FOR UPPERSTALL";
gotoxy(58,15);
cout<<"3)FOR LOWERSTALL";
gotoxy(58,16);
cout<<"ANY OTHYER TO RETURN";
gotoxy(58,17);
cout<<"ENTER CHOICE:";
cin>>e;
char m;
switch(e)
{
case '1': m='y';
while(m=='y'||m=='Y')
{
clrscr();
closegraph();
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.bal);
gotoxy(58,16);
cout<<"HOW MANY:";
cin>>num;
s.b_cancel(num);
gotoxy(58,18);
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.bal);
cout<<"CANCEL MORE(Y/N):";
cin>>m;
}
closegraph();
clrscr();
break;
case '2': m='y';
while(m=='y'||m=='Y')
{
clrscr();
closegraph();
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.upper);
gotoxy(58,16);
cout<<"HOW MANY:";
cin>>num;
s.u_cancel(num);
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.upper);
gotoxy(58,18);
cout<<"CANCEL MORE(Y/N):";
cin>>m;
}
closegraph();
clrscr();
break;
case '3': m='y';
while(m=='y'||m=='Y')
{
clrscr();
closegraph();
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.lower);
gotoxy(58,16);
cout<<"HOW MANY:";
cin>>num;
s.l_cancel(num);
//f1.read((char*)&s,sizeof(seat
s));
s.reserve(s.lower);
gotoxy(58,18);
cout<<"CANCEL MORE(Y/N):";
cin>>m;
}
closegraph();
clrscr();
break;
}
}
break;
case 4: closegraph();
clrscr();
s.f_display();
gotoxy(58,10);
cout<<"AMOUNT COLECTED:";
gotoxy(58,12);
cout<<(s.bal*120)+(s.upper*80)+(s.lower*20);
getch();
closegraph();
clrscr();
break;
}
}
getch();
closegraph();
}