#include#include using namespace std; int main() { list
myList; myList.push_back(10); myList.push_back(20); myList.push_back(30); for (auto it = myList.begin(); it != myList.end(); it++) { cout << *it << " "; } return 0; }
#includeThis code creates a list of strings and adds three elements to the list using an initialization list. It then adds another element to the front of the list and loops through the list to print out each element. The list is a part of the C++ Standard Library.#include using namespace std; int main() { list
myList = {"apple", "banana", "orange"}; myList.push_front("grape"); for (auto it = myList.begin(); it != myList.end(); it++) { cout << *it << " "; } return 0; }