Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. class Point2D {
  5. public:
  6. int x;
  7. int y;
  8.  
  9. Point2D(int x_ = 2, int y_ = 3):x(x_), y(y_) {}
  10.  
  11. };
  12.  
  13. class Circle {
  14. public:
  15. int x;
  16. int y;
  17. int r;
  18.  
  19. Circle(int x_ = 2, int y_ = 3 , int r_ = 4):x(x_),y(y_),r(r_) {}
  20.  
  21. bool is_inside(const Point2D & p ) {
  22. if ((p.x - x) * (p.x - x) + (p.y - y) * (p.y - y) <= r*r)
  23. return true;
  24. else
  25. return false;
  26.  
  27. }
  28. };
  29.  
  30. using namespace std;
  31.  
  32. int main() {
  33. Point2D punkt{1,1};
  34. Circle kolko{0,0,2};
  35. cout << boolalpha <<kolko.is_inside(punkt);
  36.  
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement