From the course: C++ Standard Template Library

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: List/vector application

Challenge: List/vector application - C++ Tutorial

From the course: C++ Standard Template Library

Start my 1-month free trial

Challenge: List/vector application

- [Instructor] We are now ready for a challenge. Here's the description. Start with the birthday party code we just wrote and add three functions to add the following features. First, print a guest's data by index. For example, print the data for guest number three. Next, removing a guest by index. And, finally, calculate the average age in the group. You can do this with a floating point number. Feel free to make it work with vectors or with lists, whichever you prefer. Here's a suggestion for the test code you will write. First, enter a series of Guest objects in a text file. For example, five guests. Then print them all out. Next, print just one guest's information by index. Let's say index number three. Then remove the same guest by index. Next, you should print all guests again to assert the last removal. And, finally, print the average age. This should take you about 30 minutes. When you are done, watch the solution video to see the code I wrote.

Contents