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

Revision as of 23:10, 7 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="cpp" line start="1" enclose="div">/* Copyright(C) 1998 All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. Perm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 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_02.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  for(int i=0; i<N; i++)
41    a2[i] = new A;
42
43  cout << "initial values after dynamic default construction-A() /";
44  cout << endl;
45
46  for(int i=0; i<N; i++)
47    cout << *a2[i] << endl;
48
49  a1.set_i1(4);
50  a1.set_i2(6);
51
52  cout << "updated values - a1 /";
53  cout << endl;
54
55  cout << a1;
56  cout << endl;
57
58  a2[0]->set_i1_i2(3);
59
60  a2[1]->set_i1_i2(1,
61                   7);
62
63  cout << "updated values - a2 /";
64  cout << endl;
65
66  for(int i=0; i<N; i++)
67    cout << *a2[i] << endl;
68
69}