Hi guys,

I'm suppose to make a database for a library system. can any of you help me out on how to assign an auto generated number for each record entered.I'm a bit new to the language.


You will need to make the first field in each record the auto-generated number. Then when you need another number, just read the last record in the file and increment the number to get the next number.

If the database is going to be fairly small you can just read the entire file into memory when the program starts so that you don't have to read it so many times. Read each record and put them into an array, or a vector. That will make it easy to get the next auto-generated number.