Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- class Point2D {
- public:
- int x;
- int y;
- Point2D(int x_ = 2, int y_ = 3):x(x_), y(y_) {}
- };
- class Circle {
- public:
- int x;
- int y;
- int r;
- Circle(int x_ = 2, int y_ = 3 , int r_ = 4):x(x_),y(y_),r(r_) {}
- bool is_inside(const Point2D & p ) {
- if ((p.x - x) * (p.x - x) + (p.y - y) * (p.y - y) <= r*r)
- return true;
- else
- return false;
- }
- };
- using namespace std;
- int main() {
- Point2D punkt{1,1};
- Circle kolko{0,0,2};
- cout << boolalpha <<kolko.is_inside(punkt);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement