Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
#include
using namespace std; int main() { list
cars = {"Volvo", "BMW", "Ford", "Mazda"}; // Add an element at the beginning cars.push_front("Tesla"); // Add an element at the end cars.push_back("VW"); // Print list elements for (string car : cars) { cout << car << "\n"; } return 0; }
Tesla
Volvo
BMW
Ford
Mazda
VW