Winter 2019

PIC 10B: Intermediate Programming

Discussion Section 3A

Wonjun Lee



Week3

Tuesday

About Pointers

Pointer quiz.cpp


Exercise P7.1 from the textbook

Implement a class Person with the following fields:

Write a program that reads in a list of names, allocates a new Person for each of them, and stores them in a vector<Person*>. Then ask the name of the best friend for each of the Person objects. Locate the object matching the friend's name and call a set_best_friend member function to update the pointer and counter. Finally, print out all Person objects, listing the name, best friend, and popularity counter for each.


Sample Output
formula random