list1.cpp

We use cookies. Read the Privacy and Cookie Policy

list1.cpp

#include ‹iostream.h›

#include ‹stl.h›

int array1[] = {9, 16, 36};

int array2[] = {1, 4};

int main() {

 list‹int› l1(array1, array1 + 3);

 list‹int› l2(array2, array2 + 2);

 list‹int›::iterator i1 = l1.begin();

 l1.splice(i1, l2);

 list‹int›::iterator i2 = l1.begin();

 while (i2!= l1.end()) cout ‹‹ *i2++ ‹‹ endl;

 return 0;

}