Yurttas/PL/OOL/Cplusplus/F/02/06/06/a 00.cpp

Revision as of 22:46, 6 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="cpp" line start="1" enclose="div">/* Copyright(C) 2004 All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. Perm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  1/*
  2   Copyright(C) 2004
  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, 2004.
 11   author : Salih Yurttas.
 12
 13   a_00.cpp
 14*/
 15
 16
 17#include <iostream>
 18
 19using namespace std;
 20
 21#include "A.h"
 22
 23int main(int argc, char* argv[]) {
 24
 25  A a_0;
 26 
 27  cout << "initial values after a_0 default construction-A() /";
 28  cout << endl;
 29  cout << a_0;
 30  cout << endl;
 31
 32  a_0.set_first_data_a(2);
 33  a_0.set_last_data_a(1);
 34
 35  a_0.set_first_data_b(7);
 36  a_0.set_last_data_b(8);
 37
 38  cout << "a_0 values after set /";
 39  cout << endl;
 40  cout << a_0;
 41  cout << endl;
 42
 43  A a_1;
 44 
 45  a_1.set_last_data_a(1);
 46  a_1.set_first_data_a(3);
 47  a_1.set_first_data_a(2);
 48  a_1.set_last_data_a(1);
 49
 50  a_1.set_first_data_b(7);
 51  a_1.set_first_data_b(7);
 52  a_1.set_first_data_b(7);
 53  a_1.set_last_data_b(8);
 54
 55  cout << "a_1 values after set /";
 56  cout << endl;
 57  cout << a_1;
 58  cout << endl;
 59
 60  a_1 += a_0;
 61
 62  cout << "a_1 values after a_1 += a_0 /";
 63  cout << endl;
 64  cout << a_1;
 65  cout << endl;
 66
 67  cout << "a_0 values after a_1 += a_0 /";
 68  cout << endl;
 69  cout << a_0;
 70  cout << endl;
 71
 72  a_1 = a_0 + a_0;
 73
 74  cout << "a_1 values after a_1 = a_0+a_0 /";
 75  cout << endl;
 76  cout << a_1;
 77  cout << endl;
 78
 79  cout << "a_0 values after a_1 = a_0+a_0 /";
 80  cout << endl;
 81  cout << a_0;
 82  cout << endl;
 83
 84  A a_2(a_1);
 85
 86  cout << "initial values after a_2(a_1) copy construction-A() /";
 87  cout << endl;
 88  cout << a_2;
 89  cout << endl;
 90
 91  cout << "a_1 values after a_2(a_1) copy construction-A() /";
 92  cout << endl;
 93  cout << a_1;
 94  cout << endl;
 95
 96  vector<int> v_0(4,
 97                  5);
 98
 99  a_1.set_all_data_a(v_0);
100
101  a_1.set_any_data_a(0,
102                     9);
103
104  vector<int> v_1(4,
105                  2);
106
107  a_1.set_all_data_b(v_1);
108
109  a_1.set_any_data_b(1,
110                     6);
111
112  a_2.set_all_data_a(v_1);
113  a_2.set_all_data_b(v_0);
114
115  a_2 = a_1 + a_1;
116
117  cout << "a_2 values after a_2 = a_1+a_1 /";
118  cout << endl;
119  cout << a_2;
120  cout << endl;
121
122  cout << "a_1 values after a_2 = a_1+a_1 /";
123  cout << endl;
124  cout << a_1;
125  cout << endl;
126
127  cout << endl;
128  cout << a_1.get_first_data_a();
129  cout << endl;
130
131  cout << endl;
132  cout << a_1.get_last_data_a();
133  cout << endl;
134
135  cout << endl;
136  cout << a_2.get_first_data_b();
137  cout << endl;
138
139  cout << endl;
140  cout << a_2.get_last_data_b();
141  cout << endl;
142
143}