Computer Science 1320

Laboratory Assignment Ten

Spring Semester 2010

 

For this final laboratory assignment we shall create a contacts list.

 

We will write a program that will be able to

add

delete

search

read

write

etc.

contacts from disk, similar to the contacts list on your cell phone. Each contact must (minimally) contain the person's first name, last name, address and phone number. We will use a structure similar to

 

typedef struct

{

            char firstname[20];

            char lastname[20]

            int areacode;

            int prefix;

            int number;

            char address1[20];

            char address2[10];

            char city[20];

            char state[3];

            int zip;

} Record;

 

The program should be menu driven, with the ability to allow the user to select the desired functionality from a menu of choices. The program should read the records into an array of records, and modify the array of records by adding, deleting, etc. As the program terminates, the user must be able to write the array of records back to disk.

 

Note that your list of contacts must be maintained in order (by last name). You will use the insert routine you developed for the insertion sort in the sorting laboratory to do this. Whenever we add a new person to the contacts list, we 'insert' it into the list so the list continues to be in order by last name.

 

Note also when the list is searched, you may search by last name using the binary search routine developed for laboratory nine. If you search for another field (phone number for example) you will search sequentially, since the list is not in order by phone number.

 

Please see class notes for details.

 

Program due date: Last day of class