📄 point.cpp
字号:
// Point.cpp: implementation of the Point class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Point.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
const Point Point::center(0,0);
Point::Point(int _x,int _y):x(_x),y(_y),center_x(0),center_y(0)
{
x=4;
y=6;
// center_x=1;
}
Point::~Point()
{
}
float Point::cal_dist(Point& pt) const
{
float x=float(this->x-pt.x);
float y=float(this->y-pt.y);
return (float)sqrt(x*x+y*y);
}
float Point::cal_dist(Point& pt)
{
float x=float(this->x-pt.x);
float y=float(this->y-pt.y);
return (float)(fabs(x)+fabs(y));
}
void Point::set_x(int newX)
{
x=newX;
}
void Point::set_y(int newY)
{
y=newY;
}
int Point::get_x() const
{
return x;
}
int Point::get_y() const
{
return y;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -