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

From ZCubes Wiki
Revision as of 22:43, 6 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)
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,2> 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_d(4);
32
33  cout << "a_0 values after a_0.set_d(2) /" << endl;
34  cout << a_0 << endl;
35  cout << endl;
36
37  a_0.set_d(8);
38
39  a_0.set_d(0,
40            3);
41
42  a_0.set_d(3,
43            9);
44
45  a_0.set_d(2,
46            6);
47
48  a_0.set_d(7,
49            7);
50
51  int n = a_0.get_s();
52
53  int* aa = new int[n];
54
55  aa = a_0.get_d();
56
57  cout << "aa after a_0.get_d() /" << endl;
58  for(int i=0; i<n; ++i)
59    cout << aa[i] << endl;
60
61  cout << endl;
62
63  T_A<int,2> a_1(a_0);
64
65  cout << "a_1 values after construction-T_A(const T_A&) /" << endl;
66  cout << a_1 << endl;
67  cout << endl;
68
69  a_1.set_d(2,
70            4);
71
72  a_1.set_d(3,
73            7);
74
75  cout << "a_1 after updated by (3,7) /" << endl;
76  cout << a_1 << endl;
77  cout << endl;
78
79  a_1 = a_0;
80
81  cout << "a_1 after a_1=a_0 /" << endl;
82  cout << a_1 << endl;
83  cout << endl;
84
85  cout << "a_0 after a_1=a_0 /" << endl;
86  cout << a_0 << endl;
87  cout << endl;
88
89}