include iostream using namespace std class vector private double int d

 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
#include <iostream>
using namespace std;
class vector
{
private:
double* b;
int dim;
public:
vector()
{
b=0;
dim=0;
}
vector(int n, double x[])
{
dim=n;
b=x;
}
vector(vector &x)
{
dim=x.dim;
b=x.b;
}
~vector()
{
if(b)
delete [] b;
}
void print()
{
cout << "{ ";
for(int i=0; i<dim; i++)
{
cout << b[i] << (i!=dim-1? ", " : "");
}
cout << " }";
}
void operator=(vector&r);
vector operator + (vector&r);
friend vector operator - (vector & e, vector &r);
vector operator -();
friend vector operator * (double k, vector &r);
friend double operator * (vector l, vector r);
};
class matrix{
};
int main(int argc, char **argv)
{
return 0;
}