include iostream include ostream using namespace std double new double

 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
#include <iostream>
//#include <ostream>
using namespace std;
double *c = new double;
double *d = new double;
double *e = new double;
double* sort(double *b, int n){
double k;
for (int q=0; q<n; q++)
for (int w=0; w<n-1; w++){
if (b[w] < b[w+1]){
k = b[w];
b[w] = b[w+1];
b[w+1] = k;
}
}
return b;
}
class massiv{
public:
int start, end;
double *a;
massiv(int start1, int end1, double *b){
a = new double[start1 - end1 + 1];
start = start1;
end = end1;
for (int q=start1; q<end1 - start1 + 1; q++)
a[q] = b[q-start1];
}
massiv(){}
massiv(double *b, int n){
start = 0, end = n - 1;
a = new double[n];
for (int q=0; q<n; q++)
a[q] = b[q];
}
void newElement(int q, int a1){
if (q <= end && q >= start)
a[q] = a1;
else
printf("Index massiva vishel za predeli dopustimih znachenii\n");
}
double getElement(int q){
if (q <= end && q >= start)
return a[q];
else
printf("Index massiva vishel za predeli dopustimih znachenii\n");
}
massiv operator=(massiv b){
return b;
}
};
bool operator ==(massiv& a, massiv& b){
bool check = false;
c = sort(a.a, a.end - a.start + 1);
d = sort(b.a, b.end - b.start + 1);
if (a.end - a.start == b.end - b.start){
for (int q=0; q<a.end - a.start; q++)
if (c[q] != d[q]){
check = true;
break;
}
}
else
check = true;
if (check == true)
return false;
else
return true;
}
massiv operator*(massiv a, int k){
for (int q=a.start; q<a.end + 1; q++){
a.a[q] *= k;
}
return a;
}
massiv operator/(massiv a1, int k){
for (int q=a1.start; q<a1.end + 1; q++){
a1.a[q] /= k;
}
return a1;
}
/*ostream operator<<(ostream &os, massiv & a)
{
for (int q=a.start; q<a.end + 1; q++)
os << a.a[q];
return os;
}*/
int main(){
}