Closest point implementation
<p>I am trying to implement a closest point program. Here is the code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;math.h&gt;
using namespace std;

float randfloat(){
    return 1.0*rand()/RAND_MAX;
}

class point
{
    public :
    float x,y;

    float distance(point&amp; a){
        float dx=x-a.x;
        float dy=y-a.y;
        return  sqrt(dx*dx+dy*dy);
    }
};

int main(int argc,char* argv[]){
    int i,cnt=0;
    int n=atoi(argv[1]);
    float d=atof(argv[2]);
    point *a=new point[n];
    for (int i=0;i&lt;n;i++)
    {
        a[i].x=randfloat();
        a[i].y=randfloat();
    }
    for (i=0;i&lt;n;i++)
        for (int j=i+1;j&lt;n;j++)
            if ((distance(a[i],a[j])&lt;d)) cnt++;
    cout &lt;&lt; cnt &lt;&lt; "pairs within" &lt;&lt; d &lt;&lt; endl;

    return 0;
}
</code></pre>

<p>But when I compile it from the command line it gives an error like this:</p>

<blockquote>
  <p>pointer is not member of base class point</p>
</blockquote>

<p>Here is the full list:</p>

<pre><code>    C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(373) : error C
2039: 'iterator_category' : is not a member of 'point'
        closet_point.cpp(9) : see declaration of 'point'
        closet_point.cpp(37) : see reference to class template instantiation 'st
d::iterator_traits&lt;_Iter&gt;' being compiled
        with
        [
            _Iter=point
        ]
C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(373) : error C
2146: syntax error : missing ';' before identifier 'iterator_category'
C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(373) : error C
4430: missing type specifier - int assumed. Note: C++ does not support default-i
nt
C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(373) : error C
2602: 'std::iterator_traits&lt;_Iter&gt;::iterator_category' is not a member of a base
 class of 'std::iterator_traits&lt;_Iter&gt;'
        with
        [
            _Iter=point
        ]
</code></pre>

<p>How can I fix this problem?</p>
