include iostream using namespace std class Vector private int int publ

 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
#include <iostream>
using namespace std;
class Vector
{
private:
int *a;
int n;
public:
Vector(int *a1, int n1)
{
a = a1;
n = n1;
}
~Vector()
{
cout << "Destructor" << endl;
}
void vectorOut()
{
for (int q=0; q<n; q++)
cout << a[q] << " ";
cout << endl;
}
void operator*(int k)
{
for (int q=0; q<n; q++)
a[q] *= k;
}
}
using namespace std;
int main()
{
cout <<"Vvedite dlinu vectora" << endl;
int n;
cin >> n;
int *a = new int[n];
cout << "Vvedite elementi vectora" << endl;
for (int q=0; q<n; q++)
cin >> a[q];
}