Question: Question: Create a struct named AddressBook that stores multiple Entry structs (that you created in the previous exercise). Your code must be saved in a

Question: Create a struct named AddressBook that stores multiple Entry structs (that you created in the previous exercise). Your code must be saved in a file named AddressBook.h and should reuse your code from Entry.h.

Member functions for AddressBook should be able to add an entry and print all the entries in the address book. Your code will be tested with the file addressBook.cpp, which reads in several entries from standard input, stores them in an AddressBook instance and prints them all out.

addressBook.cpp:

#include  #include "AddressBook.h" int main(int argc, const char * argv[]) { int n; cin >> n; string name, lastname, email; cin >> name; cin >> lastname; cin >> email; AddressBook * myAddressBook = new AddressBook(name, lastname, email); AddressBook * current; for (int i = 1; i < n; i++) { cin >> name; cin >> lastname; cin >> email; current = new AddressBook(name, lastname, email); myAddressBook->add(current); } myAddressBook->print(); return 0; } 

Sample Input:

5 Jack Daniel jack@yahoo.com Jose Cuervo jose@yahoo.com Johnnie Walker johnnie@yahoo.com Pierre Smirnoff pierre@yahoo.com Richard Hennessy richard@yahoo.com

Sample Output:

First Name: Jack Last Name: Daniel Email: jack@yahoo.com

First Name: Jose Last Name: Cuervo Email: jose@yahoo.com

First Name: Johnnie Last Name: Walker Email: johnnie@yahoo.com

First Name: Pierre Last Name: Smirnoff Email: pierre@yahoo.com

First Name: Richard Last Name: Hennessy Email: richard@yahoo.com

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!