Hi guys (again), i am here with a new program! This time, i have created an airline reservation system that allows a user to choose a seat, the problem i having is, getting the program that this to remember that this seat has been booked, any tips on how to do this?
What im asking for is for the program to remember that if a seat is booked, for it to remember that it is booked. For example, if the user books seat 5, i want it to remember that ive booked seat 5 and to prompt me that its taken, its an array code that i dont knot, can anyone help me and where to put it :/
Perhaps as each seat is taken, you could change its value from zero to one, and then when the user chooses a seat, if the value of that seat is one, it is taken, and they must choose another.
seat[0] = 0; // mark as empty
saet[4] = 1; // mark as taken
You also have arrays called firstclass and secondclass. I suggest you decide just how it is that you're keeping track of seats and remove what you don't actually need.
I was going to keep track of the seats by simply displaying the array of class, for example, if the user chooses firstclass, it will show that seats : 1 2 3 4 5 are available, once a seat is taken, i want it to no longer display the seat that is taken.
It means that sometimes count is initialized but other times it isn't, and because it is possible to access it in cases where it is not initialized, it would cause problems.
The solution is to put {} around the code after the case : statements.