I have to develop a C++ programme for airplane booking company where I have a one plane and 42 seats in the plane
There are 1st class and 2nd class and somking and nonsmoking areas.

this is a assignment I have to do.

I dont need any code but I want to discuss about the background of the programme and start the coding.

problem is I want to know what is the best data storing mechanism for the seat booking in the programme.

I think it is useless to go for database connecting instead using some data stuctures.

please be king enought give me a hint.

thanks in advance,

Re: assigning seats for a commercial plane + suitable data storing meachan 80 80

It's a bit vague, but this is one of the most common assignments given by C++ professors. They must all get together and decide to give an airline reservation assignment. A search for "airline reservation" will surely get tons of hits.

No one uses a database. It adds an unnecessary layer of complexity. Unless of course you were told to.

The best storing structure depends on the exact requirements and what you have to store. This being C++, presumably you'll have a class called "Seat". Depending on how fancy you want to get, you might have some polymorphism in there and have a SmokingSeat and NonSmokingSeat or FirstClassSeat and SecondClassSeat in there. I doubt I'd bother. Just have a Plane with 42 Seats. Each Seat would have at least three bools in there: one denoting first / second class, one denoting smoking / non-smoking, one denoting whether the seat has been sold. Depending on the other requirements, you can add more (i.e. seat price, seat row, etc., whatever the spec wants).

You'll probably have to do a few database-like operations (i.e. select / count the occupied seats given a certain criteria) and of course, find an empty seat and reserve it with a name or whatever. That's the general theme. For more specific help, you'd need to offer more details and a more precise question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.