Question: Implement class person with the following fields: - the name - a pointer to the persona best friend (a person*) - a popularity counter that

Implement class person with the following fields:
- the name
- a pointer to the persona best friend (a person*)
- a popularity counter that indicates how many other people have this person as their best friend
Write a program that reads in a list of names, allocated a new Person for each of them, and stores them Ima vector. Then ask the name of the best friend for each of the Person objects. Locate the object matching the friends name and call a set_best_friend member function to update the longer and counter. Finally, print out all Person objects, listing the name, best friend, and popularity counter for each.
 Implement class person with the following fields: - the name -

Each graded problem will be worth 50 points. Read instructions carefully! (1) Problem P7.1 . You can assume that all names in the list of people that the user provides are different . Also you can assume that a best friend of a Person is not necessarily on the ist. If it is the case, the pointer to a best friend must not be be initialized (see the sample of input-output) Submit the solution as hmw-6.1.cpp Sample input-output CAW Name John ont inue yn)? y ane: Mary ontinue (y)? y ane Lisa ontinue (y)? y ane: Alex ontinue (y)? n Enter the names of best friends: exe est friend of John: Mary est friend of Mary: Lisa est friend of Lisa: Mary Best friend of Alex: Kin Infornation: ohn Mary 0 Mary Lisa 2 Lisa Mary 1 Press any key to continue

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!