use a list cpp code example
Example: how to write C++ list
#include <iostream>
#include <list>
int main ()
{
std::list<int> first;
std::list<int> second (4,100);
std::list<int> third (second.begin(),second.end());
std::list<int> fourth (third);
int myints[] = {16,2,77,29};
std::list<int> fifth (myints, myints + sizeof(myints) / sizeof(int) );
std::cout << "The contents of fifth are: ";
for (std::list<int>::iterator it = fifth.begin(); it != fifth.end(); it++)
std::cout << *it << ' ';
std::cout << '\n';
return 0;
}