Guest User

Untitled

a guest
Jun 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. struct point{
  2. double x, y;
  3. point(double _x=0, double _y=0){
  4. x = _x;
  5. y = _y;
  6. }
  7. void read(){
  8. scanf("%lf %lf", &x, &y);
  9. }
  10. point operator +(point q){ return point(x+q.x, y+q.y); }
  11. point operator -(point q){ return point(x-q.x, y-q.y); }
  12. point operator *(double t){ return point(x*t, y*t); }
  13. point operator /(double t){ return point(x/t, y/t); }
  14.  
  15. friend ostream& operator <<(ostream& o, point p) {
  16. return o << "(" << p.x << ", " << p.y << ")";
  17. }
  18. };
Add Comment
Please, Sign In to add comment