用c++编程.定义一个类point,该类是平面坐标系上坐标点的抽象表示.类具有的功能包括:1)计算点

发布时间:2021-02-23 08:17:15

用c++编程.定义一个类point,该类是平面坐标系上坐标点的抽象表示.类具有的功能包括:1)计算点到原点的距离(distance)2)点坐标按给定的不同的偏移量进行偏移(offset)3)点坐标按给定的相同的偏移量进行偏移(offset)4)点坐标按给定的不同尺度缩放坐标值(scale)5)点坐标按给定的相同尺度缩放坐标值(scale)

网友回答

#include
#include
using namespace std;
class point
{public:
point();
point(int a,int b);
void distance();
void offset(int a);
void offset(int a,int b);
void scale(int a);
void scale(int a,int b);
private:
int x;int y;};point::point()
{x=0;y=0;}point::point(int a,int b)
{x=a;y=b;}void point::distance()
{cout
以上问题属网友观点,不代表本站立场,仅供参考!