< previous page page_800 next page >

Page 800
Because the birth date can be read with a single statement, we incorporate Get Birth Date directly into Get Entry.
In Chapter 12, we wrote functions Insert and SearchOrd to insert an item into its proper place in a list. These functions were used in the Exam program to insert last names as they were read into an array of last names. We can use the same functions here with the following minor modification. The statement that compared the item being inserted with the components already in the list was:
while (strcmp(item, list[index]) > 0)
    index++;
Because our data structure is an array of structs, item and list[index] are structs, not strings. Therefore, the name of the member that is being compared must be added as follows:
while (strcmp(item.lastName, list[index].lastName) > 0)
    index++;
When coding the design, we need to write the prompts for the phone number and the birth date. Also, we haven't made any provision for keying errors, which is not realistic. After an entry has been read and before it is entered into the address book, let's ask the user whether or not the entry is correct. If the user says it is, the entry can be stored. If the user says it is not, the entry will not be saved.
We also have not determined how to end the reading process. After each entry, let's ask the user whether another entry is to be read. Regardless of the user's response, we must stop reading if the addressBook array becomes full. The main module now needs rewriting.

 
< previous page page_800 next page >