1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
| #define _CRT_SECURE_NO_WARNINGS
#include <Windows.h>
#include <iostream>
#include <iomanip>
using namespace std;
class Toshka {
public:
float x;
float y;
public:
Toshka(){
x = 2.5;
y=4.7;
};
Toshka(float xx, float yy){
x = xx;
y=yy;
};
void show()
{
cout << x << " , " <<y;
}
};
class elips :public Toshka{
public:
float r1;
float r2;
public:
elips(){
r1 = 1;
r2 = 2;
}
elips(float xx, float yy, float rr1, float rr2){
x = xx;
y = yy;
r1 = rr1;
r2 = rr2;
}
elips(float rt, float rt2){
r1 = rt;
r2 = rt2;
}
~elips(){};
void display()
{
cout <<r1 << ", " << r2;
}
};
class Pryamoygolnic :public Toshka{
public:
float ct1;
float ct2;
public:
Pryamoygolnic(){
ct1= 1;
ct2 = 2;
}
Pryamoygolnic(float xx, float yy, float c1,
float c2){
x = xx;
y = yy;
ct1 = c1;
ct2 = c2;
}
Pryamoygolnic(int c1, int c2){
ct1 = c1;
ct2 = c2;
}
~Pryamoygolnic(){};
void display()
{
cout << ct1 << " , " <<ct2;
}
};
class elips_vp :public elips, public Pryamoygolnic{
public:
float S_el;
float S_pr;
float v_e;
public:
elips_vp(){
S_el = 6.6;
S_pr = 8.0;
v_e = 1;
}
elips_vp(float rr1, float rr2, int c1, int c2, float v,float S_e,
float S_p){
r1 = rr1;
r2 = rr2;
ct1 = c1;
ct2 = c2;
S_el = S_e;
S_pr = S_p;
v_e = (S_pr - S_el);
}
elips_vp(float Se,float Sp){
S_el = Se;
S_pr = Sp;
v_e = S_pr - S_el;
}
/*~elips_vp(){};*/
elips_vp operator - (elips_vp tr){
float res = tr.S_pr > tr.S_el ? tr.S_pr - tr.S_el : tr.S_pr;
return tr;
}
void show ()
{
cout << S_el << '/' << S_pr << " elipsvp=" << (v_e = S_pr - S_el);
}
};
class Cpiso_el_v :public elips_vp{
public:
elips_vp *A;
Cpiso_el_v(){
};
Cpiso_el_v(float Se, float Sp){
S_el = Se;
S_pr = Sp;
v_e = S_pr - S_pr;
A = new elips_vp[5];
}
Cpiso_el_v(elips_vp *Aa){
A = Aa;
};
template <class T>
void j(T*&a){
float r=0.0;
for (int i = 0; i < 5; i++){
r+=log(a[i].v_e);
}
cout <<" geometrix " <<(r/5)<<endl;
}
template <class T>
void s(T*&a){
for (int i = 0; i < 5; i++){
cout<<" "<<a[i].v_e<<" ";
}
cout << endl;
}
};
void main()
{
setlocale(0, "");
Toshka d(2.2, 3.5);
d.show();
elips s(3.3, 4.3);
s.display();
Pryamoygolnic x(4, 4);
x.display();
elips_vp v(3.3, 7.6);
v.show();
Cpiso_el_v *g = new Cpiso_el_v[5];
for (int i = 0; i < 5; i++){
g[i].v_e = (float)rand() * (10.7 - 1.5) / RAND_MAX + 1.5;
}
Cpiso_el_v b(g);
/*b.s(g);*/
b.j(g);
b.s(g);
system("pause");
} |