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

 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_00.cpp
14*/
15
16
17#include <iostream>
18#include <list>
19
20using namespace std;
21
22int main(int argc, char* argv[]) {
23
24  list<int> l;
25
26  l.push_back(3);
27
28  list<int>::iterator i1 = l.begin();
29  list<int>::iterator i2 = l.end();
30
31  while(i1!=i2)
32    cout << *i1++ << endl;
33
34  cout << endl;
35
36  l.push_back(2);
37  l.push_back(4);
38  l.push_back(7);
39
40  i1 = l.begin();
41  i2 = l.end();
42
43  while(i1!=i2)
44    cout << *i1++ << endl;
45
46}