Question: // This program demonstrates the STL list container. #include #include // Include the list header using namespace std; int main() { list myList; list ::iterator
// This program demonstrates the STL list container. #include#include // Include the list header using namespace std; int main() { list
myList; list ::iterator iter; // Add values to the list for (int x = 0; x < 100; x += 10) myList.push_back(x); // Display the values for (iter = myList.begin(); iter != myList.end(); iter++) cout << *iter << " "; cout << endl; // Now reverse the order of the elements myList.reverse(); // Display the values again for (iter = myList.begin(); iter != myList.end(); iter++) cout << *iter << " "; cout << endl; system("pause"); return 0; }
Copy & paste the code then compile and run the source code. Turn in the source code along with the output and an explanation as to 1) What the STL_example source code does. Also, answer questions like 2 ) What is STL? and 3 ) What are the pro's and con's of using STL's instead of building your own linked list or using an array as a data structure?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
