Purpose of Index Tutorial: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(Created page with " 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, ...")
 
No edit summary
Line 9: Line 9:


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.
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.
<noinclude>
Next: [[Overview of Sort Tutorial|Sort]]<br>
Back: [[Tutorial 2|Table of Contents]]
</noinclude>

Revision as of 15:37, 11 July 2013

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