"this" is a pointer, but you are using it as "this.<something>". It should be this-><something>.
Second, you've declared a default constructor for Pair but never implemented it.
Third, you should use initializer lists in the Pair constructor instead of assignment, if you've learned
initializer lists.
Fourth, x * x is strongly preferred to pow( x, 2 ), only because pow() is orders of magnitude slower
because it is more general.
Fifth, distanceTo should take its parameter by const reference instead of by value, if you've learned
about references.
Sixth, print() has no business being a member of Pair.
Seventh, prefer to declare variables at the point at which they are needed, and no earlier. Eg, do
this:
double disN1 = N3.distanceTo(N1);
and not
1 2 3 4 5
|
int main() {
double disN1;
// 10 lines of code here
disN1 = <some number>;
}
|