Yurttas/PL/OOL/Cplusplus/F/03/02/01/00/07/s 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   s_00.cpp
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "S.h"
22
23int main(int argc, char* argv[]) {
24
25  S s_0("Apple");
26
27  cout << "initial values after default construction-S() /" << endl;
28  cout << "s_0 : ";
29  cout << s_0 << endl;
30  cout << endl;
31
32  S s_1;
33
34  s_1 = s_0;
35
36  cout << "after s_1=s_0 /" << endl;
37  cout << "s_1 : ";
38  cout << s_1 << endl;
39  cout << endl;
40
41  cout << "after s_1=s_0 /" << endl;
42  cout << "s_0 : ";
43  cout << s_0 << endl;
44  cout << endl;
45
46  S s_2("Orange");
47
48  S s_3("Orange");
49
50  s_2 = s_3;
51
52  cout << "after s_2=s_3 /" << endl;
53  cout << "s_2 : ";
54  cout << s_2 << endl;
55  cout << endl;
56
57  cout << "after s_2=s_3 /" << endl;
58  cout << "s_3 : ";
59  cout << s_3 << endl;
60  cout << endl;
61
62  s_3 = s_1;
63
64  cout << "after s_3=s_1 /" << endl;
65  cout << "s_3 : ";
66  cout << s_3 << endl;
67  cout << endl;
68
69  cout << "after s_3=s_1 /" << endl;
70  cout << "s_1 : ";
71  cout << s_1 << endl;
72  cout << endl;
73
74  S s_4("Golden");
75
76  cout << "after s_4(\"Golden\") /" << endl;
77  cout << "s_4 : ";
78  cout << s_4 << endl;
79  cout << endl;
80
81  s_4 = "Golden";
82
83  cout << "after s_4=\"Golden\" /" << endl;
84  cout << "s_4 : ";
85  cout << s_4 << endl;
86  cout << endl;
87
88  s_4 = s_4 + s_3;
89
90  cout << "after s_4+s_1 /" << endl;
91  cout << "s_4 : ";
92  cout << s_4 << endl;
93  cout << endl;
94
95  cout << "s_3 : ";
96  cout << s_3 << endl;
97  cout << endl;
98
99}