Question: In C++ Using the STL list container, create the list on page 1157 (18 - 6). Define a list object, and call a function to

In C++

Using the STL list container, create the list on page 1157 (18 - 6).

Define a list object, and call a function to populate it using a loop as shown in 18-6.

Call a function to display the list and output the number of nodes in the list.

Then, call a function to add to the list the numbers (5, 15, 25, 35, 45, 55, 65, 75, 85) inserting them in numerical order using a loop, an iterator, list.begin, and list.insert.

Then call the display function to display the list again and the number of nodes.

Then reverse the list and display it again, and output the number of nodes.

Then call a function that removes the ends of the list, and then redisplay the list and the number of nodes.

All output is to be done in the output function. The output function that displays the list must accept a string for the message prior to displaying the list and the number of nodes

Sample output function declaration: void display_list(list &myList, string message);

Sample output function call: display_list(myList, "The original list is: ");

The program must use an iterator in the solution for adding the fives and for output.

In C++ Using the STL list container, create the list on page

The original list is: 0 10 20 30 40 50 60 70 80 90 The number of 1ist nodes is 10 The list with the additional numbers is: 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 The number of list nodes is now: 19 The list in reverse is 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0 The number of list nodes is 19 The list with the ends removed 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 The number of 1ist nodes is: 17 Process returned (0x8) execution tine : 0.062 s 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!