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

From ZCubes Wiki
Revision as of 23:37, 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   : September 1, 1998.
11   author : Salih Yurttas.
12
13   t_a_02.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> a;
26
27  cout << "a value after default construction-T_A<int>() /" << endl;
28  cout << a << endl;
29
30  a.set_a0(8);
31  a.set_a1(5);
32
33  cout << "a value after a.set_a0(8) /" << endl;
34  cout << "  value after a.set_a1(5) /" << endl;
35  cout << a << endl;
36
37  T_A<int> b(2);
38
39  cout << "b value after default construction-T_A<int>(2) /" << endl;
40  cout << b << endl;
41
42  T_A<int> c(b);
43
44  cout << "c value after T_A<int> c(b) /" << endl;
45  cout << c << endl;
46
47  b = a;
48
49  cout << "b value after b=a /" << endl;
50  cout << b << endl;
51
52  cout << "b.get_a0() /" << endl;
53  cout << b.get_a0() << endl;
54  cout << "b.get_a1() /" << endl;
55  cout << b.get_a1() << endl;
56
57  cout << endl;
58
59  T_A<double> d;
60
61  cout << "d value after default construction-T_A<double>() /" << endl;
62  cout << d << endl;
63
64  d.set_a0(8);
65  d.set_a1(5);
66
67  cout << "d value after d.set_a0(8) /" << endl;
68  cout << "  value after d.set_a1(5) /" << endl;
69  cout << d << endl;
70
71  T_A<double> e(2);
72
73  cout << "e value after default construction-T_A<double>(2) /" << endl;
74  cout << e << endl;
75
76  T_A<double> f(e);
77
78  cout << "c value after T_A<double> f(e) /" << endl;
79  cout << c << endl;
80
81  e = d;
82
83  cout << "e value after e=d /" << endl;
84  cout << e << endl;
85
86  cout << "e.get_a0() /" << endl;
87  cout << e.get_a0() << endl;
88  cout << "e.get_a1() /" << endl;
89  cout << e.get_a1() << endl;
90
91}