1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
|
#include <iostream>
#include <cstdlib>
#include <limits>
#include <windows.h>
using namespace std ;
int seats[16][20];
int checkClass(int row, int col) {
if( row>=0 && row<=1 && col>=4 && col<=15)
return 1;
else if( row>=0 && row<=5)
return 2;
else if( row>=6 && row<=11)
return 3;
else if( row>=12 && row<=17)
return 4;
}
void showStatics() {
int ta=0;
int ts=0;
for(int r=0;r<16;r++) {
for(int c=0;c<20;c++) {
if( seats[r][c]>0)
ta++;
if( seats[r][c]==2) {
cout << "||" << checkClass(r,c);
system("pause");
switch( checkClass(r,c) ) {
case (1): ts+= 15; break;
case (2): ts+= 12; break;
case (3): ts+= 10; break;
case (4): ts+= 6; break;
}
}
}
}
cout<<"|-------------------------------SCREEN----------------------------|"<<endl;
cout<<" Row A to Row F is Premiere Class = RM 12 ."<<endl;
cout<<" Row G to Row L is Gold Class = RM 10 ."<<endl;
cout<<" Row M to Row P is Economy Class = RM 6 ."<<endl;
cout<<" Coloumn 5 to 15 in Row A is Twin Seats = RM 15 ."<<endl;
cout << endl << "Available seats : " << (16*20-ta);
cout << endl << "Total Sell : " << (ts);
}
void showseats()
{
int alpha=65;
int r,c;
system("cls");
cout <<" 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20"<< endl;
for (r=0; r<=15; r++)
{
cout << char(alpha+r) << " ";
for (c=0; c<=19; c++)
{
if ( (c == 4) || (c == 16))
{
cout << " ";
}
if (seats[r][c] == 0)
cout << "* "; // AV = Available
else if (seats[r][c] == 1)
cout << "O "; // RS = Reserved
else if (seats[r][c] == 2)
cout << "X "; // SL = Sold
else
cout << " "; // Nothing
}
if ( r == 5 || r == 11)
{
cout <<endl<<endl;
}
cout << endl;
}
cout << endl;
showStatics();
cout << endl;
}
void CinemaMenu()
{
cout<<" "<<endl;
cout<<" (0-''-0 ).___..--' ''-'._ "<<endl;
;cout<<" `8_ 8 ) `-. ( ).`-.__.`) "<<endl;
cout<<" (_Y_.)' ._ ) `._ `. ``-..-' "<<endl;
cout<<" _..`--'_..-_/ /--'_.' ,' "<<endl;
cout<<" (il),-'' (li),' ((!.-' "<<endl;
}
void MovieMenu() // interface function
{
cout<<endl;
cout<<" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<" *****************************************************"<<endl;
cout<<" || ||"<<endl;
cout<<" || ### ### ||"<<endl;
cout<<" || # ^^ # [1] MOVIES AVAILABLE ||"<<endl;
cout<<" || MMU TIGERZ' ||"<<endl;
cout<<" || BUILT TO KILL [2] TICKET PURCHASE ||"<<endl;
cout<<" || CINEMA ||"<<endl;
cout<<" || # ^^ # Be In The Movie ||"<<endl;
cout<<" || ### ### To Feel The Heat ||"<<endl;
cout<<" || ||"<<endl;
cout<<" *****************************************************"<<endl;
cout<<" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
}
void MovieAvailable() // movie information function
{
cout<<" (1) Ethan (2011) "<<endl;
cout<<" (2) Harry Potter (2011) "<<endl;
cout<<" (3) Captain America(2011) "<<endl;
cout<<" (4) Shridi Sai Baba(2011) "<<endl;
cout<<" (5) Thai Horror (2011) "<<endl;
cout<<endl;
}
int main ()
{
int num ;
CinemaMenu();
MovieMenu();
cout<< " Press 1 to view movie available or Press 2 to purchase a movie : " << endl;
cin>>num;
if ( num == 1 )
{
MovieAvailable();
}
else if (num == 2 )
{
showseats();
int i,j;
for (i=0; i<=15; i++)
{
for (j=0; j<=19; j++)
{
seats[i][j]=0;
}
}
int r,c,a,q=0;
char k ;
while (true) {
cout << "Do you want to quit? ( 0=NO, 1=YES)";
cin >> q;
if( q==1)
break;
cout << "Which seat do you want to purchase :"<< endl;
cout << "Enter the row number : ";
cin >> k;
k=tolower(k);
int r = (k) - 96 ;
r = r -1;
cout << endl << "Enter the column number : ";
cin >> c;
c= c -1;
cout << endl << "Enter:\n0 : Cancel\n1:Reseve\n2:Sell\nYour choice : ";
cin >> a;
switch (a) {
case (0): seats[r][c]=0;break;
case (1): seats[r][c]=1;break;
case (2): seats[r][c]=2;break;
}
showseats();
}
}
else
{
cout << "Pls Kindly Press 1 or 2 only to continue using our software : " << endl ;
}
return 0;
}
|