title: Can't understand wrong answer in graphing program
body: <p>There is a problem in which they have points on a graph (~100 of them) and they all rotate by a certain amount, except one of them. I thus tackle this problem by taking the distances from the center of the first set of points, and also distances from center of the second set, then, after comparing them, one set will not have a matching distance--which will be the wrong point.</p>
  
  <pre><code>    #include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include &lt;math.h&gt;
  using namespace std;
  int main()
  {
  int star1, star2;
  cin&gt;&gt;star1;
  int x1[star1], y1[star1];
  for (int i=0; i&lt;star1; i++)
  {cin&gt;&gt;x1[i]&gt;&gt;y1[i];}
  
  cin&gt;&gt;star2;
  int x2[star2], y2[star2];
  for (int i=0; i&lt;star2; i++)
  {cin&gt;&gt;x2[i]&gt;&gt;y2[i];}
  
  int d1[star1], d2[star2];
  for (int i=0; i&lt;star1; i++)
  {d1[i]=sqrt(x1[i]*x1[i]+y1[i]*y1[i]);
   d2[i]=sqrt(x2[i]*x2[i]+y2[i]*y2[i]);
  }
  int dis=0; //the ones furthest from the center will be gone
  
  if (star1&gt;star2)
   {for (int i=0; i&lt;(star1-star2); i++)
   {if (d1[i]&lt;d1[i+1])
   {dis=i+1;} }
  
   for (int i = dis; i &lt; star1; i++)
  {d1[dis] = d1[dis+1];
  d1[star1-1] = 0;}
  }
  
   else if (star2&gt;star1)
   {for (int i=0; i&lt;(star2-star1); i++)
   {if (d2[i]&lt;d2[i+1])
   {dis = i+1;} }
  
  for (int i = dis; i &lt; star2; i++)
  {d2[dis] = d2[dis+1];
  d2[star2-1] = 0;}
   }
  
  int one, two;
  for (int begin=0; begin&lt;star1; begin++)
  { 
  for (int i=0; i&lt;star2; i++)
   {if (d1[begin]==d2[i])
   {one=begin; two=i;
   goto finish;}}
    }
    finish:
    cout&lt;&lt;one&lt;&lt;" "&lt;&lt;two;
    }
  </code></pre>
  
  <p>The original problem: <a href="http://www.codeabbey.com/index/task_view/wandering-star" rel="nofollow">http://www.codeabbey.com/index/task_view/wandering-star</a>
  Is it something wrong with my code, or something wrong with my interpretation?</p>