Yurttas/PL/OOL/Cplusplus/F/03/01/02/00/b 00.cpp

Revision as of 21:54, 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   : January 1, 1998.
11   author : Salih Yurttas.
12
13   b_00.cpp
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "B.h"
22
23const int N = 2;
24
25int main(int argc, char* argv[]) {
26
27  B b_0;
28
29  cout << "initial values after construction-B(int) /" << endl;
30  cout << b_0 << endl;
31  cout << endl;
32
33  int* aa = new int[N];
34
35  aa = b_0.get_d();
36
37  cout << "aa after b_0.get_d() /" << endl;
38  for(int i=0; i<N; ++i)
39    cout << aa[i] << endl;
40
41  cout << endl;
42
43  b_0.set_d(9);
44
45  cout << "b_0 after updated by (9) /" << endl;
46  cout << b_0 << endl;
47  cout << endl;
48
49  B b_1(b_0);
50
51  cout << "initial values after construction-B(B&) /" << endl;
52  cout << b_1 << endl;
53  cout << endl;
54
55  b_1.set_d(3,7);
56
57  cout << "b_1 after updated by (3,7) /" << endl;
58  cout << b_1 << endl;
59  cout << endl;
60
61  b_1.set_d(aa);
62
63  cout << "b_1 after updated by (aa) /" << endl;
64  cout << b_1 << endl;
65  cout << endl;
66
67  b_1 = b_0;
68
69  cout << "b_1 after b_1=b_0 /" << endl;
70  cout << b_1 << endl;
71  cout << endl;
72
73  cout << "b_0 after b_1=b_0 /" << endl;
74  cout << b_0 << endl;
75  cout << endl;
76
77}