Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef long long ftype;
- struct point3d {
- ///We can declear as :
- /// point3d a (2, 3, 5);
- ftype x, y, z;
- point3d() {}
- point3d(ftype x, ftype y, ftype z): x(x), y(y), z(z) {}
- point3d& operator+=(const point3d &t) {
- x += t.x;
- y += t.y;
- z += t.z;
- return *this;
- }
- point3d& operator-=(const point3d &t) {
- x -= t.x;
- y -= t.y;
- z -= t.z;
- return *this;
- }
- point3d& operator*=(ftype t) {
- x *= t;
- y *= t;
- z *= t;
- return *this;
- }
- point3d& operator/=(ftype t) {
- x /= t;
- y /= t;
- z /= t;
- return *this;
- }
- point3d operator+(const point3d &t) const {
- return point3d(*this) += t;
- }
- point3d operator-(const point3d &t) const {
- return point3d(*this) -= t;
- }
- point3d operator*(ftype t) const {
- return point3d(*this) *= t;
- }
- point3d operator/(ftype t) const {
- return point3d(*this) /= t;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement