All pastes #936469 Raw Edit

Cinema Assignment

public cpp v1 · immutable
·published 2008-03-10 13:32 UTC
rendered paste body
#include <stdio.h>#include <iostream.h>void ClearSeats(); // Takes the Array of Seats and sets them all to empty.void PrintSeats(); // Prints all the seats on the screen.int SeatPrice(int,int);  // Returns the price for the given seat.int EmptySeats(int);char Seat[14][19];int main(void){ ClearSeats(); PrintSeats(); PrintMenu();  return 0;}/////Functions//////void ClearSeats(){ int x,y; for (y=0;y<20;y++){  for (x=0;x<15;x++){ Seat[x][y]='O'; } }}int SeatPrice(int x,int y){  if (x  <= 7){return 3;    } else {     if (x <= 14) {return 4;}      else { return 5; }    };}void PrintSeats(){ int x,y; for (y=0;y<20;y++){  cout << y+1 << " ";  if ((y+1)< 10) { cout <<" "; }  // Cosmetic Addition. Keeps Ver. Alignement.  for (x=0;x<15;x++){   cout << "[" << Seat[x][y] << "]";  }  cout<<endl; } cout << "    1  2  3  4  5  6  7  8  9  10 11 12 13 14 15" ;}int EmptySeats(int price) { int x,y; int Empty=0; if (price=0){                         // If you give price of 0, it will   for (y=0;y<20;y++){                 // find all the empty seats.    for (x=0;x<15;x++){     if (Seat[x][y]=='O') { Empty=Empty+1; }    }   } return Empty; }  if (price=3){   for (y=0;y<8;y++){    for (x=0;x<15;x++){     if (Seat[x][y]=='O') { Empty=Empty+1; }    }   } return Empty; }   if (price=4){   for (y=8;y<15;y++){    for (x=0;x<15;x++){     if (Seat[x][y]=='O') { Empty=Empty+1; }    }   } return Empty; }   if (price=5){   for (y=15;y<20;y++){    for (x=0;x<15;x++){     if (Seat[x][y]=='O') { Empty=Empty+1; }    }   } return Empty; }}