Yurttas/PL/OOL/Cplusplus/F/03/01/02/00/e 00.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   e_00.cpp
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "E.h"
22
23int main(int argc, char* argv[]) {
24
25  E e_0;
26
27  cout << "initial values after construction-E(int) /" << endl;
28  cout << e_0 << endl;
29  cout << endl;
30
31  int n = e_0.get_s();
32
33  int* aa = new int[n];
34
35  aa = e_0.get_d();
36
37  cout << "aa after e_0.get_d() /" << endl;
38  for(int i=0; i<n; ++i)
39    cout << aa[i] << endl;
40
41  cout << endl;
42
43  e_0.set_d(9);
44
45  cout << "e_0 after updated by (9) /" << endl;
46  cout << e_0 << endl;
47  cout << endl;
48
49  E e_1(e_0);
50
51  cout << "initial values after construction-E(E&) /" << endl;
52  cout << e_1 << endl;
53  cout << endl;
54
55  e_1.set_d(3,7);
56
57  cout << "e_1 after updated by (3,7) /" << endl;
58  cout << e_1 << endl;
59  cout << endl;
60
61  n = e_1.get_s();
62
63  aa = new int[n];
64
65  for(int i=0; i<n; ++i)
66    aa[i] = 5;
67
68  e_1.set_d(aa);
69
70  cout << "e_1 after updated by (aa) /" << endl;
71  cout << e_1 << endl;
72  cout << endl;
73
74  e_1 = e_0;
75
76  cout << "e_1 after e_1=e_0 /" << endl;
77  cout << e_1 << endl;
78  cout << endl;
79
80  cout << "e_0 after e_1=e_0 /" << endl;
81  cout << e_0 << endl;
82  cout << endl;
83
84  E e_2(8,7);
85
86  cout << "initial values after construction-E(int) /" << endl;
87  cout << e_2 << endl;
88  cout << endl;
89
90}