Each time I use

int main(int argc, char *argv[])

to try to get input from command line, there is a crash of the and it says:

"xxx.exe has stopped working". What's the problem?

I am trying to run the example code:

I am new for C++, and desperate to fix the problem. Can anyone help me out?Code:#include <iostream> #include <stdlib.h> #include "POINT.cpp" using namespace std; int main(int argc, char *argv[]) { float d = atof(argv[2]); int i, cnt = 0, N = atoi(argv[1]); POINT *a = new POINT[N]; for (i = 0; i < N; i++) for (int j = i+1; j < N; j++) if (a[i].distance(a[j]) < d) cnt++; cout << cnt << " pairs within " << d << endl; return 0; } #include <math.h> class POINT { private: float x, y; public: POINT() { x = 1.0*rand()/RAND_MAX; y = 1.0*rand()/RAND_MAX; } float distance(POINT a) { float dx = x-a.x, dy = y-a.y; return sqrt(dx*dx + dy*dy); } };

Thanks very much!