title: Find min value in array
body: <p>I have two arrays: </p>
  
  <pre><code>int playerSums[9] = { };
  string playerNames[9] = { };
  </code></pre>
  
  <p>I am trying to get the <strong>smallest value</strong> in the array <code>playerSums</code> and also the <strong>array index</strong> of this value.</p>
  
  <p>Here's what I've tried so far:</p>
  
  <pre><code>if (playerNames[index] == "End" || playerNames[index] == "end") {
      int lowestValue = playerSums[0];
      for (i = 1; i &lt; sizeof(playerSums) / sizeof(playerSums[0]); i++) {
          if (playerSums[i] &lt; lowestValue || lowestValue != 0)
              lowestValue = playerSums[i]; 
      }
      cout &lt;&lt; index[playerNames] &lt;&lt; " had the lowest values and got the sum ";
      cout &lt;&lt; lowestValue &lt;&lt; endl;
  }
  </code></pre>
  
  <p>How do I find and display the smallest value in the array <code>playerSums</code> if for example <em>only 3 players</em> are playing, i.e. only 3 elements of the array are populated (and the rest of the elements are equal to zero)?</p>
  
  <p>I need the index to display the name of the player who got the smallest value.</p>