Yurttas/PL/OOL/Cplusplus/F/07/01/02/00/l 02.cpp

From ZCubes Wiki
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_02.cpp
14*/
15
16
17#include <iostream>
18#include <list>
19
20using namespace std;
21
22int a1[] = {1,4,3,2};
23int a2[] = {8,7};
24
25int main(int argc, char* argv[]) {
26
27  list<int> l1(a1, a1+4);
28  list<int> l2(a2, a2+2);
29
30  list<int>::iterator i1 = l1.begin();
31  l1.splice(i1,
32            l2);
33
34  i1 = l1.begin();
35  list<int>::iterator i2 = l1.end();
36
37  while(i1!=i2)
38    cout << *i1++ << endl;
39
40}