This Project created by me "Divine.Jakiro" Best Friend "Yap Henry".

1. Array

2. Structures

3. Validation

4. Screenshots

5. Reflection




1. Array

ArrayDescriptionData Type
seat_ID[4][6]This is a two dimension array with 4 rows and 6 column which is use to store the seat available.int
row2[4]To store how many seat that are available for the customer of each row.int
price_row[6]To store the price in each of the row which is have a total 6 row.int
col[4]To store how many seat that seat that are available for the customer of each column.int
price_col[4]To store the price in each of the column which is have a total 4 column.int




2. Structures

StructureVariable nameDescription
ticketTICKET[24]To store the price of the ticket and the seat ID.




3. Validation

1. The number of seats must not be more than available, if not re-enter again.

2. The seat required must be available, If not, re-enter again.

3. The cash paid must not be less than the amount that need to pay. If not, re-enter again.


Cinema Example

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

void welcome();
void SEAT();
void booking();
void booking1();
void ticket();
void report();
void CONTINUE();

int seat_ID[4][6]={0};
int
count=0,check,row[4]={0},row2[4]={0},price_row[6]={0},col[4]={0},price_col[4]={0}, total_price=-;
int l
int num1;
double pay=0,row_price[4]={0},column_price[6]={0},total_sal1e=0,percent;
char movie_title[20],date[20],time[20],category[20],seat_id[20];
int movie_code;
struct ticket
{
blankchar seatID[3];
blankdouble ticket_price;
}TICKET[24];

struct ticket SEATID[24];

void main()
{
blankl=0;
blankwelcome();
blankSEAT();
blankbooking1();
}


void SEAT()
{
blankint i,j;


blankcount=0;
blankrow[0]=0,row[1]=0,row[2]=0,row[3]=0;

++price_row[0]=0,price_row[1]=0,price_row[2]=0,price_row[3]=0,price_row[4]=0,price_row[5]=0;
++col[0]=0,col[1]=0,col[2]=0,col[3]=0;
++price_col[4]=0,price_col[1]=0,price_col[2]=0,price_col[3]=0;
++total_price=0;
++for(i=0;i<4;i++){

blankfor(j=0;j<6;j++){

newblankif(seat_ID[i][j]==0)
newblank{
newnewblankcount++;
newnewblankrow2[i]++;
newblank}
newblankif(seat_ID[i][j]==1){
newblankif(i==0||i==1)
newblank{
newnewblankprice_row[j]+=20;
newnewblankprice_col[i]+=20;
newnewblanktotal_price+=20;
newblank}
newblankelse
newblank{
newnewblankprice_row[j]+=25;
newnewblankprice_col[i]+=25;
newnewblanktotal_price+=25;
newblank}
newblank}
newblankcol[j]++;
newblank}
newblankif(seat_ID[i][j]==0)
newblank{
newblankrow[i]++;

newblank}

++}
++percent=double(24-count)/24*100;
++printf("++++|++++++++++Seat Occupancy++++++++\n\n");
font color="#FFFFFF">++printf("++++|+++++++++++01++++02++03++++++04++05++06
Seats Avaible++\n");
++printf("++++|++++++----------------------------------------------\n");
++++printf("+++---|++---A|%2d|%2d|%2d|++++|%2d|%2d|%2d|+++++%d\n",seat_ID[0][0],seat_ID[0][1],seat_ID[0][2],seat_ID[0][3],seat_ID[0][4],seat_ID[0][5],row2[0]);
++++printf("++++|++++B|%2d|%2d|%2d|++++%2d|%2d|%2d|+++++++++++%d\n",seat_ID[1][0],seat_ID[1][1],seat_ID[1][2],seat_ID[1][3],seat_ID[1][4],seat_ID[1][5],row2[1]);
++++printf("+++++|++++++------------------------------------------------\n");
+++printf("+++++|+++++|+++++Aisle+++++++++++++++Aisle+++Aisle++|\n");
+++printf
+++++++("++++++++|++C|%2d|%2d|%2d|++++|%2d|%2d|%2d
|++++++++%d\n",seat_ID[2][0],seat_ID[2][1],seat_ID[2][2],seat_ID[2][3],seat_ID[2][4],seat_ID[2][5],row2[2]);
+++printf("+++++|++++++D|%2d|%2d|%2d|+++++++|%2d|%2d|%2d|++++++++%d\n",seat_ID[3][0],seat_ID[3][1],seat_ID[3][2],seat_ID[3][3],seat_ID[3][4],seat+ID[3][5],row2[3]);
++++printf("++++|+++++++-------------------------------------\n");

++++printf("There still have %d available seat.\n\n",percent);
++++printf(Occupancy Rate =%.2If%%\n\n",percent);
++++check=count
++++row2[0]=0,row2[1]=0,row2[2]=0,row2[3]=0;
}



void welcome(){

++++printf("*********** WELCOME ************ \n);
+++++printf("**++++++++++++TO+++++++++++)*\n");
++++printf("**+++++++TARC SCREEN CINEMAS+++++++*\n");
++++printf("*+++++**********************************+++++*\n");
+++++printf("-----------------------------");
+++printf("MOVIE CODE++:");
++++scanf("%d",&movie_code);
++++printf("CATEGORY+++:");
++++scanf("%s",&category);
++++printf("MOVIE TITLE+++:");
++++scanf("%[^\n]",&movie_title);
++++printf("DATE+++++++++:");
++++scanf("%s",&date);
++++printf("TIME+++++++++:");
++++scanf("%s",&time);


}


void booking();
{
++++int number;


++++printf("How many seats required?");
++++scanf("%d",&number);


++++if(number>count)
++++{
+++++++printf("Not enough seats.\n");
++++}
++++else
++++{
+++++++booking1();
++++}

}

void booking1()
{ ++++int a,b,j,i,h;
++++int number;
++++double total_sale,payment,change;


++++printf("How many seats required?");
++++scanf("%d",&number);
++++if(number==1)
++++{
++++report();}
++++if(number>check){
++++do{
++++++printf()"Not enough seat.\n";
++++scanf("%d",&number);
++++}while(number>check);
++++}
++++++num1=number;
++++++if(number>count);
++++{
++++++printf("Not enough seats.\n");
++++++booking();
++++}
++++for(i=0;i ++++}
+++++++printf("Enter your seat ID.");
++++fflush(stdin);


++++scanf("%s",TICKET[I}.seatID);
++++a = Int(TICKET[I],seatID[0])-65;
++++b = Int(TICKET[I],seatID[2])-49;
++++if((strien(TICKET[I].seatID)==3)&&a>=0&&a<=3&&b>=0&&a<=5&&TICKET[I].seatID[1]==48)
++++{
+++++++if(seat_ID[a][b]==1)
+++++++{
++++++++++do
++++++++++{
++++++++++++++printf("Have been book\n");
++++++++++++++scanf("%s",TICKET[I].seatID);
++++++++++++++a = int(TICKET[I].seatID[0])-65;
++++++++++++++b = int(TICKET[I].seatID[2])-49;
++++++++++}
++++++++++while(seat_ID[a][b]==1);