-
variables
If I have a database and I dont know how many entries I am going to have is there a way to set it up where it wont matter how many entries i have? Sorry if i didnt explain it right. Also is a way where i start up a program enter some info and then i am able to exit that program and when i start it back up it will remember where i left off? thx for any help.
Wanted420:)
-
For your first question a linked list would probably be the best. As for the second question, store the data in a file. Use file streams for that (ifstream/ofstream).
-
>For your first question a linked list would probably be the best.
Actually, it depends more on how lookup would be handled. Lists can only be searched sequentially and databases that have a large number of records implemented as a list can get slow. I would go with a dynamically sized hash table or balanced binary tree/skip list if I had to write a database in C++.
-
actually, you might not need anything like that... it depends on what you want to do with it... for example, if you want to do an average with numbers, just put it in a loop...
another method is just to add something at the end of the data file... then search through it until you find that last item(number) and then search the file again until you get to that line number...
-
The way I read it, the answer to the first question would be dinamic memory allocation. The answer to the second, yes, it would be a file with the program settings.