answersLogoWhite

0

#include<iostream>

#include<list>

int main()

{

// the linked list (of integers)

std::list<int> List;

// insertions:

List.push_back (42);

List.push_back (99);

List.push_back (60);

List.push_front (55);

// point to first node

std::list<int>::iterator n = List.begin();

// advance to next node

++n;

// insert in front of node n

list.insert (n, 33);

// print list:

for (auto node : List) std::cout << node << std::endl;

}

User Avatar

Wiki User

10y ago

What else can I help you with?