Yurttas/PL/OOL/Cplusplus/F/03/02/02/00/14/v 00.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   : January 1, 1998.
 11   author : Salih Yurttas.
 12
 13   v_00.cpp
 14*/
 15
 16
 17#include <iostream>
 18
 19using namespace std;
 20
 21#include "V.h"
 22
 23int main(int argc, char* argv[]) {
 24
 25  V v_0;
 26
 27  cout << "initial values after default construction-V() /" << endl;
 28  cout << "v_0 :" << endl;
 29  cout << v_0 << endl;
 30  cout << endl;
 31
 32  V v_1(2);
 33
 34  cout << "initial values after default construction-V() /" << endl;
 35  cout << "v_1 :" << endl;
 36  cout << v_1 << endl;
 37  cout << endl;
 38
 39  V v_2(v_1);
 40
 41  cout << "initial values after copy construction-V(const V&) /" << endl;
 42  cout << "v_2 :" << endl;
 43  cout << v_2 << endl;
 44  cout << endl;
 45
 46  cout << "v_1 :" << endl;
 47  cout << v_1 << endl;
 48  cout << endl;
 49
 50  V v_3;
 51
 52  cout << "initial values after default construction-V() /" << endl;
 53  cout << "v_3 :" << endl;
 54  cout << v_3 << endl;
 55  cout << endl;
 56
 57  v_3 = v_0;
 58
 59  cout << "values after v_3 = v_0  /" << endl;
 60  cout << "v_3 :" << endl;
 61  cout << v_3 << endl;
 62  cout << endl;
 63
 64  cout << "v_0 :" << endl;
 65  cout << v_0 << endl;
 66  cout << endl;
 67
 68  v_3 = v_1;
 69
 70  cout << "values after v_3 = v_1  /" << endl;
 71  cout << "v_3 :" << endl;
 72  cout << v_3 << endl;
 73  cout << endl;
 74
 75  cout << "v_1 :" << endl;
 76  cout << v_1 << endl;
 77  cout << endl;
 78
 79  v_3 = v_3;
 80
 81  cout << "values after v_3 = v_3  /" << endl;
 82  cout << "v_3 :" << endl;
 83  cout << v_3 << endl;
 84  cout << endl;
 85
 86  cout << "v_3 :" << endl;
 87  cout << v_3 << endl;
 88  cout << endl;
 89
 90  int a = v_3[1];
 91
 92  cout << "a=v_3[1] :" << endl;
 93  cout << a << " " << v_3[1] << endl;
 94  cout << endl;
 95
 96  v_3[1] = a;
 97
 98  cout << "v_3[1]=a :" << endl;
 99  cout << v_3[1] << " " << a << endl;
100  cout << endl;
101
102  v_3 = v_1 + v_2;
103
104  cout << "values after v_3 = v_1+v_2 /" << endl;
105  cout << "v_3 :" << endl;
106  cout << v_3 << endl;
107  cout << endl;
108  cout << "v_1 :" << endl;
109  cout << v_1 << endl;
110  cout << endl;
111  cout << "v_2 :" << endl;
112  cout << v_2 << endl;
113  cout << endl;
114
115  bool b;
116
117  b = (v_3==v_3);
118
119  cout << "truth for v_3==v_3 /" << endl;
120  cout << b << endl;
121  cout << endl;
122
123  b = (v_3==v_1);
124
125  cout << "truth for v_3==v_1 /" << endl;
126  cout << b << endl;
127  cout << endl;
128
129  b = (v_3==v_2);
130
131  cout << "truth for v_3==v_2 /" << endl;
132  cout << b << endl;
133  cout << endl;
134
135}