Yurttas/PL/OOL/Cplusplus/F/03/01/05/00/a 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   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 default construction-A() /" << endl;
28  cout << a_0 << endl;
29  cout << endl;
30
31  cout << "private k value after default construction-A() /" << endl;
32  cout << endl;
33  cout << a_0.get_k() << endl;
34  cout << endl;
35
36  A a_1[2];
37
38  cout << "initial values after construction-A[] /" << endl;
39  for(int i=0; i<2; i++)
40    cout << a_1[i] << endl;
41  cout << endl;
42
43  A a_2(2);
44
45  cout << "initial values after default construction-A(int) /" << endl;
46  cout << a_2 << endl;
47  cout << endl;
48
49  A a_3[] = { a_0, a_2 };
50
51  cout << "initial values after construction-A[] /" << endl;
52  for(int i=0; i<2; i++)
53    cout << a_3[i] << endl;
54  cout << endl;
55 
56  A a_4[] = { A(), A(5), A(1) };
57
58  cout << "initial values after construction-A[] /" << endl;
59  for(int i=0; i<3; i++)
60    cout << a_4[i] << endl;
61  cout << endl;
62
63}