title: My sorting algorithm ignores lines of code,why?
body: <p>Ive tried to use an 'odd' sorting algorithm just to see if i can manage make it work, basically the algorithm finds the smallest number and places it first, then it repeats this loop but starting from the second number, ignoring the already sorted one completely, but for some reason it seems to not ignore the first sorted number and constantly swaps it out.</p>
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      int n,i,j;
      int min;
      int a[10];
      cin&gt;&gt;n;
      for(i=0;i&lt;n;i++)
      {
       cout&lt;&lt;&quot;a[&quot;&lt;&lt; i &lt;&lt;&quot;]=&quot;;
      cin&gt;&gt;a[i];
      }
      min=a[0];
      for(i=0;i&lt;n;i++)
      {
       for(j=i;j&lt;n;j++)
       {
        if(min&gt;a[j])
        min=a[j];
       }
      a[j]=a[i];
      a[i]=min;
      min=100;
      }
      for(i=0;i&lt;n;i++)
      cout&lt;&lt;a[i];
      return 0;
      
  }
  </code></pre>