41 lines
676 B
C++

#include <iostream>
#include <cmath>
#include "Point.h"
Point::Point() : x(0), y(0) {
}
Point::Point(const Point& t) : x(t.x), y(t.y) {
}
Point::Point(int xy) : x(xy), y(xy) {
}
Point::Point(int xx, int yy) {
//Point::Point(int x, int y) {
//Point::Point(int x, int y) : x(x), y(y) {
x=xx;
y=yy;
//this->x=x;
//this->y=y;
}
Point::~Point() {
}
int Point::getX() {
return x;
}
int Point::getY() {
return y;
}
void Point::print() {
std::cout << "(" << x << ", " << y << ") " << std::endl;
}
double Point::distance(Point t) {
return std::sqrt((double)(x - t.x)*(x - t.x)+(y - t.y)*(y - t.y));
}