So I have recently decided to make a program that replicas something an estate agent may use when booking viewings.
I have already made the basics eg. house listings, details etc - Thats all dandy.
However I want to be able to add new customers and new house listings into my program, that can then be searched for when required.
Just wondering which is the best method to use? I've tried using an array in my main which worked fine, however I can't seem to figure out how to move this into a class.
being a noobie it would be appreciated if someone could give me some insight on how to go about building what I want.
I think what you want is a std::vector. It works just like an array in most cases, but you can call yourVector.push_back ( newItem ); to easily add new items to your list. Since this is a list, you could also use std::list. It has some of the same functionality, but is implemented a bit differently. Which one you use really depends on how you need to access your data.
You almost never want to use a linked list in modern code. A vector will always be the better choice.
OP, depends on how you want this data stored. Do you want the data to persist between executions? You need some external storage, like a file or database. If you just want the data to exist during a single execution, stick it in some data structure. An std::vector is always a good choice. Maps are also nice depending on your needs.
It's hard to give you a good answer when you give us such little information.
I didn't know that about lists. I've never actually used one except in class, but that was to learn how they worked and that it exists in the stl. We spent maybe a week on it and never talked about it again.
I've never actually used one except in class, but that was to learn how they worked
That's good, and will probably be the last time you use one. They're good to know because more advanced data structures are built with those concepts, but just a plain list has very little use anymore.