Yurttas/PL/OOL/Cplusplus/F/05/01/01/03/t a 24.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   : September 1, 1998.
 11   author : Salih Yurttas.
 12
 13   t_a_24.cpp
 14*/
 15
 16
 17#include <iostream>
 18
 19using namespace std;
 20
 21#include "T_A.cpp"
 22#include "t_aa.cpp"
 23
 24int main(int argc, char *argv[]) {
 25
 26  T_A<int,int> a;
 27
 28  t_aa("a value after default construction-T_A<int,int>() /",
 29       a);
 30
 31  a.set_a0(8);
 32  a.set_a1(5);
 33
 34  t_aa("a value after a.set_a0(8) /\n  value after a.set_a1(5) /",
 35       a);
 36
 37  T_A<int,int> b(2);
 38
 39  t_aa("b value after default construction-T_A<int,int>(2) /",
 40       a);
 41
 42  T_A<int,int> c(b);
 43
 44  t_aa("c value after T_A<int,int> c(b) /",
 45       c);
 46
 47  b = a;
 48
 49  t_aa("b value after b=a /",
 50       b);
 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,double> d;
 60
 61  t_aa("d value after default construction-T_A<double,double>() /",
 62       d);
 63
 64  d.set_a0(8);
 65  d.set_a1(5);
 66
 67  t_aa("d value after d.set_a0(8) /\n  value after d.set_a1(5) /",
 68       d);
 69
 70  T_A<double,double> e(2);
 71
 72  t_aa("e value after default construction-T_A<double,double>(2) /",
 73       e);
 74
 75  T_A<double,double> f(e);
 76
 77  t_aa("f value after T_A<double,double> f(e) /",
 78       f);
 79
 80  e = d;
 81
 82  t_aa("e value after e=d /",
 83       e);
 84
 85  cout << "e.get_a0() /" << endl;
 86  cout << e.get_a0() << endl;
 87  cout << "e.get_a1() /" << endl;
 88  cout << e.get_a1() << endl;
 89
 90  cout << endl;
 91
 92  T_A<int,double> p;
 93
 94  t_aa("p value after default construction-T_A<int,double>() /",
 95       p);
 96
 97  p.set_a0(8);
 98  p.set_a1(5);
 99
100  t_aa("p value after p.set_a0(8) /\n  value after p.set_a1(5) /",
101       p);
102
103  T_A<int,double> q(2);
104
105  t_aa("q value after default construction-T_A<int,double>(2) /",
106       q);
107
108  T_A<int,double> r(q);
109
110  t_aa("r value after T_A<int,double> r(q) /",
111       r);
112
113  r = q;
114
115  t_aa("r value after r=q /",
116       r);
117
118  cout << "r.get_a0() /" << endl;
119  cout << r.get_a0() << endl;
120  cout << "r.get_a1() /" << endl;
121  cout << r.get_a1() << endl;
122
123  cout << endl;
124
125  T_A<double,int> s;
126
127  t_aa("s value after default construction-T_A<double,int>() /",
128       s);
129
130  s.set_a0(8);
131  s.set_a1(5);
132
133  t_aa("s value after s.set_a0(8) /\n  value after s.set_a1(5) /",
134       s);
135
136  T_A<double,int> t(2);
137
138  t_aa("t value after default construction-T_A<double,int>(2) /",
139       t);
140
141  T_A<double,int> u(t);
142
143  t_aa("u value after T_A<double,int> u(t) /",
144       u);
145
146  t = s;
147
148  t_aa("t value after t=s /",
149       t);
150
151  cout << "t.get_a0() /" << endl;
152  cout << t.get_a0() << endl;
153  cout << "t.get_a1() /" << endl;
154  cout << t.get_a1() << endl;
155
156}