title: c++ Output only the max array value and count
body: <p>I was comparing the array values in format arr[i] > arr[max]</p>
  
  <p>It outputs all the values which is greater to arr[0].</p>
  
  <p>Can you guys give me tips on how to ouput JUST the greatest value?</p>
  
  <p>Code:</p>
  
  <pre><code>    for(int i=0;i&lt;4;i++){   
          cout&lt;&lt;"Enter how many pancakes eaten by the Person #"&lt;&lt;i&lt;&lt;" : ";
          cin&gt;&gt;pancake;
          person[i] = pancake;            
      }
      for(int i=0;i&lt;4;i++){
          if(person[i]&gt;person[i+1]){
              pancakeCount = pancake[i];
              cout&lt;&lt;"The number of most eaten pancakes is "&lt;&lt;pancakeCount&lt;&lt;" by Person#"&lt;&lt;i&lt;&lt;endl;
          }
      }
  </code></pre>
  
  <p>The problem is the output:</p>
  
  <p>Output:</p>
  
  <pre><code>    //list of persons and the number of pancakes they ate.
      The number of most eaten pancakes is 10 by Person#7
      The number of most eaten pancakes is 10 by Person#9
  </code></pre>
  
  <p>each time I put the greatest value before the last iteration, it also outputs the last iteration containing the greatest value which is Person#7</p>
  
  <p>I only want the highest value to be the output itself.</p>