Yurttas/PL/SL/python/F/08/00/01/01/a 03.cpp

 1/*
 2   Copyright(C) 1998
 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   : January 1, 1998.
11   authorĀ : Salih Yurttas.
12
13   a_03.cpp
14*/
15
16
17#include <iostream>
18#include <vector>
19
20using namespace std;
21
22#include "A.h"
23
24const int N=2;
25
26int main(int argc, char* argv[]) {
27
28  A a1;
29
30  cout << "initial values after default construction-A() /";
31  cout << endl;
32
33  cout << a1.get_i1();
34  cout << endl;
35  cout << a1.get_i2();
36  cout << endl;
37
38  vector<A> a2(N);
39
40  cout << "initial values after dynamic default construction-A() /";
41  cout << endl;
42
43  for(int i=0; i<N; i++)
44    cout << a2[i] << endl;
45
46  a1.set_i1(4);
47  a1.set_i2(6);
48
49  cout << "updated values - a1 /";
50  cout << endl;
51
52  cout << a1;
53  cout << endl;
54
55  a2[0].set_i1_i2(3);
56
57  a2[1].set_i1_i2(1,
58                  7);
59
60  cout << "updated values - a2 /";
61  cout << endl;
62
63  for(int i=0; i<N; i++)
64    cout << a2[i] << endl;
65
66}