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

  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_v_02.cpp
 14*/
 15
 16
 17#include <iostream>
 18
 19using namespace std;
 20
 21#include "T_V.cpp"
 22
 23int main(int argc, char* argv[]) {
 24
 25  T_V<int> a_0;
 26
 27  cout << "a_0 values after construction-T_V() /" << endl;
 28  cout << a_0 << endl;
 29  cout << endl;
 30
 31  a_0.set_d(2);
 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(4);
 38
 39  a_0.set_d(0,
 40            3);
 41
 42  a_0.set_d(3,
 43            9);
 44
 45  int n = a_0.get_size();
 46
 47  vector<int> aa = a_0.get_d();
 48
 49  cout << "aa after a_0.get_d() /" << endl;
 50  for(int i=0; i<n; i++)
 51    cout << aa.at(i) << endl;
 52
 53  cout << endl;
 54
 55  T_V<int> a_1(a_0);
 56
 57  cout << "a_1 values after construction-T_V(const T_V&) /" << endl;
 58  cout << a_1 << endl;
 59  cout << endl;
 60
 61  a_1.set_d(3,
 62            7);
 63
 64  cout << "a_1 after updated by (3,7) /" << endl;
 65  cout << a_1 << endl;
 66  cout << endl;
 67
 68  a_1 = a_0;
 69
 70  cout << "a_1 after a_1=a_0 /" << endl;
 71  cout << a_1 << endl;
 72  cout << endl;
 73
 74  cout << "a_0 after a_1=a_0 /" << endl;
 75  cout << a_0 << endl;
 76  cout << endl;
 77
 78  cout << endl;
 79
 80  T_V<double> b_0;
 81
 82  cout << "b_0 values after construction-T_V() /" << endl;
 83  cout << b_0 << endl;
 84  cout << endl;
 85
 86  b_0.set_d(2);
 87
 88  cout << "b_0 values after b_0.set_d(2) /" << endl;
 89  cout << b_0 << endl;
 90  cout << endl;
 91
 92  b_0.set_d(4);
 93
 94  b_0.set_d(0,
 95            3);
 96
 97  b_0.set_d(3,
 98            9);
 99
100  n = b_0.get_size();
101
102  vector<double> bb = b_0.get_d();
103
104  cout << "bb after b_0.get_d() /" << endl;
105  for(int i=0; i<n; i++)
106    cout << bb.at(i) << endl;
107
108  cout << endl;
109
110  T_V<double> b_1(b_0);
111
112  cout << "b_1 values after construction-T_V(const T_V&) /" << endl;
113  cout << b_1 << endl;
114  cout << endl;
115
116  b_1.set_d(3,
117            7);
118
119  cout << "b_1 after updated by (3,7) /" << endl;
120  cout << b_1 << endl;
121  cout << endl;
122
123  b_1 = b_0;
124
125  cout << "b_1 after b_1=b_0 /" << endl;
126  cout << b_1 << endl;
127  cout << endl;
128
129  cout << "b_0 after b_1=b_0 /" << endl;
130  cout << b_0 << endl;
131  cout << endl;
132
133}