|
|
|
|
|
|
|
Figure 14-13
Entry for Struct Variable addressBook[0] |
|
|
|
|
|
|
|
|
We have now defined a data structure to hold the information in our address book. Before we can finish the algorithms to read the data, we have to decide how we want to enter the data. Let's enter it interactively, prompting the user to enter each component. Here is a refined version of the Get Name module. |
|
|
|
|
|
|
|
|
Get Name (Out: entry) Level 2 |
|
|
|
|
|
|
|
|
Prompt user for first name
Read entry.firstName
Prompt user for last name
Read entry. lastName |
|
|
|
|
|
|
|
|
|
We also redo the module for getting the phone number. |
|
|
|
|
|
|
|
|
Get Phone Number (Inout: entry) |
|
|
|
|
|
|
|
|
Prompt user for area code, then a blank, then the number
Read entry.areaCode
Consume the blank
Read entry.phoneNumber |
|
|
|
|
|
|