在我的程序中,我创建了一个Point用两个值调用的构造函数。我还有一个set, get,scale和translate函数。我正在尝试创建一个函数,使我能够获取对象与另一个点之间的距离。我遇到了麻烦,但任何帮助都会很棒。
#ifndef POINTMODEL
#define POINTMODEL
#define POINTDEB UG
#include <iostream>
#include <string.h>
using namespace std;
class Point {
public:
Point(void);
Point(double anX, double aY);
~Point();
void setPoint(double anX, double aY);
double getX();
double getY();
double scaleX(double theX);
double scaleY(double theY);
void translate(double theX, double theY);
void distance(const Point& aPoint);
protected:
private:
double theX;
double theY;
};
inline Point::Point(void)
{
theX = 1;
theY = 1;
cout << "\n The default …Run Code Online (Sandbox Code Playgroud)