Yurttas/PL/OOL/Cplusplus/F/07/01/02/00/l 03.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_03.cpp
14*/
15
16
17#include <iostream>
18#include <list>
19
20using namespace std;
21
22int a1[] = {1,4,3,2,6,9};
23int a2[] = {8,7,5};
24
25int main(int argc, char* argv[]) {
26
27  list<int> l1(a1, a1+6);
28  list<int> l2(a2, a2+3);
29
30  l1.merge(l2);
31
32  list<int>::iterator i1 = l1.begin();
33  list<int>::iterator i2 = l1.end();
34
35  while(i1!=i2)
36    cout << *i1++ << endl;
37
38}