Yurttas/PL/OOL/Cplusplus/F/05/01/02/04/00/t a 00.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 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   t_a_00.cpp
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "T_A.cpp"
22
23int main(int argc, char* argv[]) {
24
25  T_A<int,int> a_0;
26
27  cout << "a_0 values after construction-T_A() /" << endl;
28  cout << a_0 << endl;
29  cout << endl;
30
31  a_0.set_d0_d1(2);
32
33  cout << "a_0 values after a_0.set_d0_d1(2) /" << endl;
34  cout << a_0 << endl;
35  cout << endl;
36
37  a_0.set_d0_d1(4,
38                3,
39                5);
40
41  cout << "a_0 values after a_0.set_d0_d1(4,3,5) /" << endl;
42  cout << a_0 << endl;
43  cout << endl;
44
45  int n = a_0.get_s();
46
47  int* aa = new int[n];
48
49  aa = a_0.get_d0();
50
51  cout << "aa after a_0.get_d0() /" << endl;
52  for(int i=0; i<n; ++i)
53    cout << aa[i] << endl;
54
55  cout << endl;
56
57  T_A<int,int> a_1(a_0);
58
59  cout << "a_1 values after construction-T_A(const T_A&) /" << endl;
60  cout << a_1 << endl;
61  cout << endl;
62
63  a_1.set_d0_d1(3,
64                7,
65                2);
66
67  cout << "a_1 after updated by (3,7,2) /" << endl;
68  cout << a_1 << endl;
69  cout << endl;
70
71  a_1 = a_0;
72
73  cout << "a_1 after a_1=a_0 /" << endl;
74  cout << a_1 << endl;
75  cout << endl;
76
77  cout << "a_0 after a_1=a_0 /" << endl;
78  cout << a_0 << endl;
79  cout << endl;
80
81}