Purpose of Index Tutorial
The main reason we create index files is so that the user can quickly access any record by key, instead of sorting through all the records every time. On large master files, this saves time. Write a quick program, NAMEFIND to access records based on last names. This will involve the following steps:
- Prompting the user for a last name
- Opening the file
- Reading it by key (the last name input)
- Displaying the complete record
A more complicated program might then accept changes, print a label, or any number of other actions.
But wait! What if two people have the last name? Add lines to the program to solve this problem if the first search does not provide the correct person. See the solutions page for help.