Advertisement
Guest User

Point.cpp

a guest
Feb 18th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. //============================================================================
  2. // Name        : point.cpp
  3. // Author      : deloge
  4. // Version     :
  5. // Copyright   : Your copyright notice
  6. // Description : Hello World in C++, Ansi-style
  7. //============================================================================
  8.  
  9. #include <iostream>
  10. using namespace std;
  11. #include "point.h";
  12.  
  13. Point::Point(){
  14.     x=0;
  15.     y=0;
  16. }
  17.  
  18. Point::Point(float xx,float yy){
  19.     x=xx;
  20.     y=yy;
  21. }
  22.  
  23. float Point::getX(){
  24.     return x;
  25. }
  26.  
  27. float Point::getY(){
  28.     return y;
  29. }
  30.  
  31. void Point::setX(float xx){
  32.     x=xx;
  33. }
  34.  
  35. void Point::setY(float yy){
  36.     y=yy;
  37. }
  38.  
  39. Point Point::milieu(Point p1){
  40.     Point p2;
  41.     float x1,y1;
  42.     x1=(x+p1.getX())/2;
  43.     y1=(y+p1.getY())/2;
  44.     p2.setX(x1);
  45.     p2.setY(y1);
  46.     return p2;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement