I am currently writing a program for a Uni project that acts as a video rental store system.

I am about to write the part which will create a customer rental histroy file. The main problem I face is... how do I read and write a unknown number of histroy records for each customer?

So... my question is; does the method (to follow) sound like a good way of writing this? or is it totally lame and bad programming practice?



The program:

Currently there is a customer file, each customer has a unique number to identify them.

I then plan to create another text file which holds history data. If a customer had rented three films previously, then the history file would look like:

1003 3
0F
3A
7B


where the first two numbers are the customer number, and total numer of history items respectively. And the three hex numbers are the ID's of the films. (The formatting may vary, this hasn't been written yet, its ust an example).

The program when asked for the history of a customer, would look for their ID number, it would then read the number of history items that customer has. Then memory would be allocated to read into a dynamic array the film ID's. The program would then have to cross reference each film ID and retrieve the title of the film from another text file containing all the films.

-----------------------------------------------

Obviously I want to get good marks for my program, and so I don't want the program to be pointlessly long and complicated.... is there a better way of doing what I am doing? or does this seem reasonable??

Many thanks