title: c++ Reading 3D coordinates from a large array and calculating the distance between them
body: <p>I've got an assignment due that I'm really struggling :</p>
  
  <blockquote>
    <p>Write a program that reads input-week6-ad-q3.txt (3D coordinates of 200 points) into arrays and report the followings
    1. Distances between point1 and others (consider 1st coordinate is point1, 2nd point2,,,.)
    2. The point which is the closest to point 1 and the distance between point1 and the closest point.</p>
  </blockquote>
  
  <p>I've tried to start it but I can't get the coordinates in at the moment and I don't even know where to start in finding the closest point. Any help would be much appreciated. </p>
  
  <p>This is what I've got so far:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  
  const int MAX = 200;
  typedef double x_coord[MAX];
  typedef double y_coord[MAX];
  typedef double z_coord[MAX];
  
  int main()
  {
      x_coord x;
      y_coord y;
      z_coord z;
      int count;
      ifstream in_stream;
  
      in_stream.open("input-week6-ad-q4-2.txt");
      in_stream.get(x, y, z);
      for (count = 0; count &lt; MAX; count++)
      {
          x[count] = x;
          in_stream.get(x);
  
          y[count] = y;
          in_stream.get(y);
  
          z[count] = z;
          in_stream.get(z);
      }
      in_stream.close();
  
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>The input file has the points layed out like this: </p>
  
  <pre><code>Coordinates of many points  
     x        y         z
  -0.06325 0.0359793 0.0420873 
  -0.06275 0.0360343 0.0425949 
  -0.0645 0.0365101 0.0404362 
  </code></pre>
  
  <p>ect.</p>