list4.cpp

We use cookies. Read the Privacy and Cookie Policy

list4.cpp

#include ‹iostream.h›

#include ‹stl.h›

int array1[] = {1, 3, 6, 7};

int array2[] = {2, 4};

int main() {

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

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

 l1.merge(l2);

 for (list‹int›::iterator i = l1.begin(); i != l1.end(); i++) cout ‹‹ *i;

 cout ‹‹ endl;

 return 0;

}