Assignment about STRUCT and BINARY SEARCH in C... A help will be much appreciated!
Posted on 2003-03-24
Write a program which does the following:
1. Creates a binary file with the following structure
2. Allows entry of record into the above structure
3. data entry loop to be terminated by some user action of your own choice
4. records to be saved (one at a time) into a binary file
5. creates another binary index file with the following structure -
For each record in the person file (the first file) create a record in this index file such that the id field is the same (as the record in the person file) and offset is the offset of the record in the person file. The records in the index should be sorted on id order
6. Your program should have a screen with the following capabilities:-
a. Viewing of record for any existing id that the user enters (with appropriate message if id does not exist)
b. Viewing of next record ( assuming there is already a record on the screen)
c. Viewing of previous record (assuming there is already a record on the screen)
The suer should be able to continue viewing records until he/she chooses to exit.
Access to records should be via the index file. Access to records in the index file should be via binary search
Note: The binary search algorithm only works on a sorted file
I'm a software development student, I'm trying to cope up with all of my subjects
I need a hand with this assignment..
Thanks a lot