#includeIn this example, we have created a List object named myList and initialized it with five elements. We then use the append() function to add the element 6 to the end of the list. Finally, we iterate over the updated list and print its elements. The List type and its append() function are part of the Standard Template Library (STL) in C++. Therefore, the list package library needs to be included to use them.#include using namespace std; int main() { list
myList = { 1, 2, 3, 4, 5 }; // Append an element to the end of the list myList.append(6); // Print the updated list for (auto it = myList.begin(); it != myList.end(); ++it) cout << *it << " "; return 0; }