Question: CSE 412- Project #5 Write a program in C++ which will reserve seats for a concert. There are 5 rows of 8 seats, a random

CSE 412- Project #5

Write a program in C++ which will reserve seats for a concert. There are 5 rows of 8 seats, a random access file must be used to keep track of which seats have been reserved. Each seat will have one byte reserved to indicate whether it is taken or not. The seat s in row r is recorded in byte (8*r+s-1) of the file to indicate that the seat is occupied (record an "O") You may create the random access file prior to running the programs, it simply needs to have zero length. Every request will be followed by a conrimatory response, and the date and time should also be recorded. The protections of the data file (concert.dat) are: $touch concert.dat and $chmod uh+lrw concert.dat

Your program should prompt for a function $ Reserve or Display . D results in the display of occupied seats while R prompts for the row number and then a range of sat numbers. Entering Q quits the program. All file entries should be in raw I/O format (using buffers) with error control and boundary checking.

Run 1:

Reserve seats 2-5 in row 1

Reserve seats 4-7 in row 2

Attempt to reserve seat 4 in row 2 - rejected

Reserve seat 3 in row 1

Display reserved seats:

1 2 3 4 5 6 7 8

X O O O O O O O

X X X O O O X X

X X X X X X X X

X X X X X X X X

X X X X X X X X

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!