It could be more logical to have the distance() as standalone function, rather than as member. A distance between two points is the same as distance between this and that, but with a slightly different look and feel.
You could fill a N*N 2D matrix with the distances. On the diagonal the result is obviously 0.0, because that represents point to itself. The matrix is symmetric, so checking one triangle covers all cases. That is probably what you were trying.
Lets take a 4 point {A,B,C,D} case:
1 == The A's distance to B, C and D:
2 == The B's distance to C and D:
3 == C's distance to D
4. D has already been located by all
ABCD
A.111
B .22
C .3
D . |
Can you figure out from that example how the row and column indices (counters of the two nested loops) should go?
(You don't need to store values in actual matrix; all you need to keep are the min and max.)
Edit: IIRC, either prefix or suffix double underscores are reserved for library use. It might be safer to use different names in the header inclusion guards.