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

Revision as of 23:39, 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)
  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_04.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;
 26
 27  cout << "a value after default construction-T_A<int,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,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,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,double> d;
 60
 61  cout << "d value after default construction-T_A<double,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,double> e(2);
 72
 73  cout << "e value after default construction-T_A<double,double>(2) /" << endl;
 74  cout << e << endl;
 75
 76  T_A<double,double> f(e);
 77
 78  cout << "c value after T_A<double,double> c(b) /" << 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  cout << endl;
 92
 93  T_A<int,double> p;
 94
 95  cout << "p value after default construction-T_A<int,double>() /" << endl;
 96  cout << p << endl;
 97
 98  p.set_a0(8);
 99  p.set_a1(5);
100
101  cout << "p value after p.set_a0(8) /" << endl;
102  cout << "  value after p.set_a1(5) /" << endl;
103  cout << p << endl;
104
105  T_A<int,double> q(2);
106
107  cout << "q value after default construction-T_A<int,double>(2) /" << endl;
108  cout << q << endl;
109
110  T_A<int,double> r(q);
111
112  cout << "c value after T_A<int,double> r(q) /" << endl;
113  cout << c << endl;
114
115  q = p;
116
117  cout << "q value after q=p /" << endl;
118  cout << q << endl;
119
120  cout << "q.get_a0() /" << endl;
121  cout << q.get_a0() << endl;
122  cout << "q.get_a1() /" << endl;
123  cout << q.get_a1() << endl;
124
125  cout << endl;
126
127  T_A<double,int> s;
128
129  cout << "s value after default construction-T_A<double,int>() /" << endl;
130  cout << s << endl;
131
132  s.set_a0(8);
133  s.set_a1(5);
134
135  cout << "s value after s.set_a0(8) /" << endl;
136  cout << "  value after s.set_a1(5) /" << endl;
137  cout << s << endl;
138
139  T_A<double,int> t(2);
140
141  cout << "t value after default construction-T_A<double,int>(2) /" << endl;
142  cout << t << endl;
143
144  T_A<double,int> u(t);
145
146  cout << "u value after T_A<double,int> u(t) /" << endl;
147  cout << u << endl;
148
149  t = s;
150
151  cout << "t value after t=s /" << endl;
152  cout << t << endl;
153
154  cout << "t.get_a0() /" << endl;
155  cout << t.get_a0() << endl;
156  cout << "t.get_a1() /" << endl;
157  cout << t.get_a1() << endl;
158
159}