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

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