codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
class vector { public: float i; float j; float k; vector& operator+(vector v) { vector *temp=new vector; temp->i=i+v.i; temp->j=j+v.j; temp->k=k+v.k; return *temp; } vector& operator-(vector v) { vector *temp=new vector; temp->i=i-v.i; temp->j=j-v.j; temp->k=k-v.k; return *temp; } vector& operator*(float x) { vector *temp=new vector; temp->i=i*x; temp->j=j*x; temp->k=k*x; return *temp; } float operator*(vector x) { return i*x.i+j*x.j+k*x.k; } vector& operator=(vector x) { this->i=x.i; this->j=x.j; this->k=x.k; return *this; } };
Private
[
?
]
Run code
Submit