title: How to compare the value inside of an array
body: <p>So Im writing a program that asks the user to input the number of pancakes a person(1-10) had for breakfast. The program must analyze the input and determine which person ate the most pancakes. Also the program must output a list in order of number of pancakes eaten of all 10 people. So far I have written the code to get the user input and the code to display the array, but not in order. Im completely lost when it comes to comparing the elements in the array:</p>
  
  <pre><code>int getPancakes();
  void displayArray(int theArray[],int sizeOfArray);
  void compareArray(int sizeOfArray);
  int pancakes[10];
  int z = 0;
  
  int main()
  {
  }
  
  int getPancakes(){
      int y;
      int x = 0;
  
      for(int y = 0; y &lt; 10; y++){
          ++x;
          cout &lt;&lt; "How many pancakes did person " &lt;&lt; x &lt;&lt; " eat?" &lt;&lt; endl;
          cin &gt;&gt; pancakes[y];
      }
  }
  
  void displayArray(int theArray[],int sizeOfArray){
      for(int x = 0 ;x &lt; sizeOfArray ; x++){
          ++z;
          cout &lt;&lt; "Person " &lt;&lt; z &lt;&lt; " ate " &lt;&lt; pancakes[x] &lt;&lt; " pancakes" &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>So how can I instruct my program to compare the elements inside the array? Also how can I instruct my program to print the list of number of pancakes eaten by each person in order? </p>