Purpose of Index Tutorial

From BR Wiki
Jump to navigation Jump to search

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:

  1. Prompting the user for a last name
  2. Opening the file
  3. Reading it by key (the last name input)
  4. 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.


Next: Sort
Back: Table of Contents