The format of the file is: int key;char lastName;char firstName; char phone; where key is a social security number (no dashes) of the person. Create an array of 100 entries as formatted above and initialize all integer elements to zero and string elements to spaces. Read each record on the [url removed, login to view] file and as each is read, use modulo-division hashing algorithm to determine the index in the array where the record will be stored. Before storing the record, check to see if it will have a collision with an existing array element. If there is a collision, print a message that indicates a collision has occurred and what the key values involved are. Then resolve the collision using the key-offset method described in the text. As you resolve the collision, keep in mind that another collision may occur and you will need to print the collision message each time that happens. Once you have processed the entire file, print the index and contents of the non-zero elements of the array. Place all of these displays into a file called directory Do not actually display them on the console. Next display a menu for the user to select from the following options: Enter one of the following options: 1. Search the directory by Name 2. Search the directory by SSN 3. Quit If the user selects option 1, prompt the user to enter a last name. Search the array using an unordered sequential search and display all information for all people that match that last name. If the user selects option 2, prompt the user to enter a social security number. Use the hashing method to find that person and display all information for that [url removed, login to view] the average number of comparisons executed to perform each of the searches and display the results.
I would like the program to be done in Visual C++.
Windows 98, ME, 2000, XP Visual C++