I have a function that displays a seating chart for a flight reservation. Once a seat is booked, the seat is assigned a value of 1. I need the seating chart to display the booked seat in parentheses. I'm stuck on how to get it to do this.
Here is a link to what the output currently looks like:
https://i.imgur.com/xej2Smu.png
Your function looks like it should do the job, but I have some questions.
1. Where is the "display" function defined?
2. "seatingChart[index][y][x]" looks like a 3D array. Where is it defined and how does the function know about this array?
With out the rest of the code I can only guess at what there is to work with. I can put something together to test the function, but it may not be correct or what you have.
What I set up to test the function is the same as what you have just not as big.
So, when I tested the function it worked showing reserved seats with "(1)".
Right now I am not finding anything wrong with the "displaySeatingChart" function unless it is from somewhere else in the program. I will check that in a little bit.
Just curious as to what the first dimension is for and why it is of size "8"?
The actual seat number itself like, 10C, is supposed to be in parentheses (10C). I'm not sure how to get the program to do that instead of what it is currently doing with the (1).
The first dimension is for the number of flights there are, and there is a total of 8 flights with different ID's.
Well, this is and isn't what I was looking for. I need to have the seat display like it is in the original function. Otherwise, you did manage to get the parentheses around the seat ID, so thank you! I see now how it's done. :)
Sorry for the delay, but some days some of the posts I work on get by me when I am away from the computer.
The only difference I see between your first output and mine is that mine is indented. Not that the indentation was my first intention. I was just trying to line up the numbers better.
If you do not like my version just remove the "std::setw(5)" from both lines and it will look like your original output.