How can i make it so that a user can create as many new entries as they want, then delete any that they don't need anymore. I know this has to do with construtors and deconstructors, but i don't know how to get them to work. here's my code as of now.
thanks in advance
Sounds like your basic CreateReadUptadeDelete app.
There are 3 solutions that come to mind.
1. You can use a .txt file to mimic a Database table. You could create a new file for each user and store there addresses. This would allow them to build up their address book over time.
2. You could use dynamic memory to allocate a new Address struct or class on the fly. Since the addresses would be stored in memory, they must start from scratch every time they run the program.
3. You could preallocate a set amount of address objects and skip the whole dynamic allocation. This has the same weakness as #2 but also adds a memory overhead and potential limit on how many addresses they can store. (you could always try to allocate the max amount that the users hardware will allow to cancel out the limit but now your memory overhead is through the roof)
It looks like you already have your address class but you might want to correct some errors before you decide an approach to take.
- In that classes current state, there is no need for a destructor. If you decide approach #2 then lines 31- 37 will me important.
- You can remove the function declarations because you are defining your functions before you main(). You only need to declare your functions when your main() is before there implementation.