Question: in c++ The main() must create an empty std::list container and then call std::generate_n() with a std::back_inserter on your, currently empty, list to insert the

in c++

The main() must create an empty std::list container and then call std::generate_n() with a std::back_inserter on your, currently empty, list to insert the IDs/names for the initial N number of people by using the provided generator class. Note that the SEQ class is provided for use as the last argument to generate_n() that you will have to construct passing it the number of people N for for which it will generate names (for example SEQ(num_people). Once the list generated, print it using print_list() and initialize an iterator to the first element in your list. Advance your iterator by one each time through then loop until you reach the next element to eliminate. After each elimination, if it is time, call print_list() to see an incremental state of the elimination process. Your elimination loop continues until only one person remains in the list where you will print the list one last time to see the last survivor.

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!