Yurttas/PL/OOL/Cplusplus/F/03/01/05/02/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#include <vector>
19
20using namespace std;
21
22#include "A.h"
23
24int main(int argc, char* argv[]) {
25
26  A a_0;
27
28  cout << "initial values after default construction-A() /" << endl;
29  cout << a_0 << endl;
30  cout << endl;
31
32  vector<A> a_1;
33
34  int n = a_1.size();
35
36  cout << "initial values after construction-vector<A> /" << endl;
37  for(int i=0; i<n; i++)
38    cout << a_1[i] << endl;
39  cout << endl;
40
41  vector<A> a_2(2);
42
43  n = a_2.size();
44
45  cout << "initial values after construction-vector<A> /" << endl;
46  for(int i=0; i<n; i++)
47    cout << a_2[i] << endl;
48  cout << endl;
49 
50  A a_a[] = { A(), A(5), A(1) };
51
52  vector<A> a_3(a_a, a_a+3);
53
54  n = a_3.size();
55
56  cout << "initial values after construction-vector<A> /" << endl;
57  for(int i=0; i<n; i++)
58    cout << a_3[i] << endl;
59  cout << endl;
60 
61  
62}