title: How to get largest value after leaving one array value?
body: <p>i am currently having problem getting largest values from an array, here is my code:</p>
  
  <pre><code>#include &lt;cmath&gt;
  #include &lt;cstdio&gt;
  #include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;algorithm&gt;
  using namespace std;
  
  
  int main() {
      int a[10],max=0,j,secondbig=0;
      for(int i=0;i&lt;10;i++)
          {
          cin&gt;&gt;a[i];
  
      }
      max = a[0];
      for(int i=0;i&lt;10;i++)
          {
          if(a[i]&gt;max){
              max=a[i];
              j=i;
          }
      }
      secondbig=a[10-j-1];
      for(int i=0;i&lt;10;i++)
          {
          if(secondbig &lt;a[i] &amp;&amp; j != i)
            secondbig =a[i];
      }
      cout&lt;&lt;max&lt;&lt;"\n"&lt;&lt;secondbig;
      return 0;
  }
  </code></pre>
  
  <p>What i want to do is to first get maximum value from an array and then leave one array value and then get second largest value and same for third largest value, for example :</p>
  
  <pre><code>200
  100
  50
  300
  400
  500
  600
  700
  800
  900
  </code></pre>
  
  <p>If in the above test values 900 is the largest value then the subsequent second and third largest value should be 700 and 500, is there anyway to do that?</p>