#1464. 类实现:点的平移

类实现:点的平移

Description

输入一个点坐标*(x,y),再出输入平移距离,输出平移后的点坐标(X,Y)

Input Format

int main()
{
 
 Point p;
 int x,y;
 while(cin>>x>>y){
  int k,j;
  p.SetPt(x,y);
  cout <<"x=" <<p.GetX() <<" y=" <<p.GetY() <<endl;
  cin>>k>>j;
  p.OffsetPt(k,j);
  cout <<"X=" <<p.GetX() <<" Y=" <<p.GetY() <<endl; 
 }
 
 return 0;
}

0 0
2 5
10 10
3 4
x=0 y=0
X=2 Y=5
x=10 y=10
X=13 Y=14

Source

未分类