I want to make an airline reservation system using C++. It will have various options like:
1. Book a flight
2. Search for passenger name
3. Cancel a flight
etc, etc.
Can I use structures to store information about the passengers? Its like using structures as a database? Or should I go for learning C++ connectivity with the database. I am still new to C++ programming. I am not sure whether structures can be used to hold various information like (passenger name, passenger destionation, passenger number, etc.)
A structure represents a grouping of data in its most basic form. The simplest answer is Yes, structures can group passenger information together, fight information together, etc. But by themselves, structures are just a representation of the data in memory. You need to decide a method of persisting that data somewhere. You can choose text files, or XML files or even a big database engine like MySQL or MS SQL Server. They serve two different purposes, but granted, they complement each other.
You mean that structures can be used but the data won't be persistent. The data can be entered via. terminal but it will be lost when the program stops executing. Is there a way we can "save" the data we enter e.g. we enter the passenger information. Can we save it to structure somehow?
Like I said, the structure itself is just a reprsentation of the data in memory. You can persist the underlying data by using a file stream and write it to disk. Or you can connect to a SQL server and store the data in a database. How you want to do it is really up to you. So the answer is Yes, we can save the structures somehow.