Professional Documents
Culture Documents
Ass9 PDF
Ass9 PDF
Ass9 PDF
Write a complete C++ program (including good comments) that uses classes and arrays of objects to
implement an address book.
You will define at least two classes. One class must have at least three members, and at least one of the
members must be another nested class that you define.
For example, you may create a Contact class with the following information:
person’s name (which is another class), address (also may be another class), home phone, cell phone,
email address, etc.
You will define the class above main() so that you can use it in all the functions. However, the actual
array of objects should be defined in main().
1. Read in data to fill up address book:
In order for the program to begin, you will need to populate the address book. The best way to do this is
to call a function to read in the data from a file. You may fix the amount of entries in the array to make
the programming easier.
Thus, the main function will begin by calling the function readdata sending it two parameters: the array
of objects and n. The function will read information about n objects.
NOTE: we did an example in class in which a function printEmployee accepted an array as a parameter.
For each contact, read in a value for each of the members in the class. The data must be entered in the
input file in the exact order that you read in the members. You can use infile>> to read everything. [If
you choose, you can use gettline() but you will need some calls to cin.ignore()].