Yurttas/PL/OOL/Cplusplus/cpp/07/01/02/00/l 12.cpp
Jump to navigation
Jump to search
1/*
2 Copyright(C) 2002
3 All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4
5 Permission to use, copy, modify, and distribute this
6 software and its documentation for EDUCATIONAL purposes
7 and without fee is hereby granted provided that this
8 copyright notice appears in all copies.
9
10 date : June 1, 2002.
11 author : Salih Yurttas.
12
13 l_12.cpp
14*/
15
16
17#include <iostream>
18#include <list>
19
20using namespace std;
21
22int a1[] = {1,4,3,2,5,6};
23int a2[] = {8,7};
24
25int main(int argc, char* argv[]) {
26
27 list<int> l1(a1, a1+6);
28 list<int> l2(a2, a2+2);
29
30 list<int>::iterator i1 = l1.begin();
31 list<int>::iterator i2 = l1.end();
32
33 ++i1;
34
35 l1.splice(i1,
36 l2,
37 l2.begin(),
38 l2.end());
39
40 i1 = l1.begin();
41 i2 = l1.end();
42
43 while(i1!=i2)
44 cout << *i1++ << endl;
45
46}