usepoint.cpp
来自「C++&datastructure书籍源码,以前外教提供现在与大家共享」· C++ 代码 · 共 30 行
CPP
30 行
#include <iostream>
using namespace std;
#include "point.h"
int main()
{
Point p;
Point q(3.0, 4.0);
// print the points
cout << "p = " << p << " q = " << q << endl;
q.x *= 2;
q.y *= 2;
cout << "q doubled = " << q << endl;
p = q;
if (p == q)
{ cout << "points are now equal" << endl;
}
else
{ cout << "points are NOT equal" << endl;
}
p = Point(0,0);
cout << q.distanceFrom(p) << " = distance of q from " << p << endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?