#include #include // Include the list header file
using namespace std;
int main() { // Create a list of integers list mylist;
// Add elements to the list
mylist.push_back(10);
mylist.push_back(20);
mylist.push_back(30);
// Iterate through the list and print its elements
cout << "List elements: ";
for (auto it = mylist.begin(); it != mylist.end(); ++it) {
cout << *it << " ";
}
cout << endl;
// Accessing elements by index is not supported in lists,
// but you can iterate or use other methods to access elements.
// Other operations such as pop_back(), push_front(), pop_front(),
// insert(), erase(), clear(), etc., are also available for lists.
return 0;
}