6pa4a

BACKGROUND / MOTIVATION : ==>

Text

Visual

Audio

 

RESERVATIONS

Reservations for a small concert hall have been stored in a file called reserv_a.txt. The hall contains 35 rows, with 20 seats in each row. The seats in each row are numbered 0 through 9 for the left side and 10 through 19 on the right side.

The data file contains 35 lines of information. each line has 20 integers corresponding to the 20 seats. The value for a seat is either 0 or 1, representing either empty or an occupied seat. You must use the file provided and submit it as xxxx6pa4adat.txt.

Write a complete program in C++ which does the following:

  1. Reads the reservation information from the data file into a two dimensional array seat[35][20].
  2. Echo prints the array seat.
  3. Finds and reports all pairs of adjacent seats that are empty. The location ( row number and seat number) of the seats must be printed. Adjacent aisle seats should not be reported. If three adjacent seats are empty, then both pairs must be reported, if four adjacent seats are empty then all three pairs must be reported e.t.c.
  4. If no pairs of seats are available, it prints an appropriate message.

Your results must be written both on the screen and also on a file named xxxx6pa4arep.txt

You must prepare three files with the names xxxx6pa4a.cpp, xxxx6pa4adata.txt, xxxx6pa4arep.txt .