title: (c++) Function calculating average returns (first score / total number of scores)?
body: <p>So the program gathers a number of scores specified, then displays them in ascending order, then <em>is supposed to</em> show the average score. But right now, it only takes the first score displayed, and is divided by the number of scores. How can I make it display correctly?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  
  using namespace std;
  
  void sortArray(int*, int);
  double getAverage(int*, int);
  
  
  int main()
  {
  int *scores;
  int num_Tests;
  
  cout &lt;&lt; "How many test scores would you like to enter?" &lt;&lt; endl;
  cin  &gt;&gt; num_Tests;
  
  scores = new int[num_Tests];
  
  cout &lt;&lt; "\nEnter score number (do not use negative numbers):\n";
      for (int count = 0; count &lt; num_Tests; count++)
      {
      cout &lt;&lt; count + 1 &lt;&lt; ". ";
      cin &gt;&gt; scores[count];
      }
  
  sortArray(scores, num_Tests);
  
  cout &lt;&lt; "\n\n";
  cout &lt;&lt; "\n\n________________________________________________________________________________" &lt;&lt; endl;
  cout &lt;&lt; "Test Score List (in ascending order)" &lt;&lt; endl;
  cout &lt;&lt; "________________________________________________________________________________" &lt;&lt; endl;
  
      for (int count = 0; count &lt; num_Tests; count++)
      {
      cout &lt;&lt; count + 1 &lt;&lt; ". ";
      cout &lt;&lt; scores[count] &lt;&lt; endl;
      }
  
  cout &lt;&lt; "\nAverage test score: " &lt;&lt; getAverage(scores, num_Tests) &lt;&lt; endl;
  
  return 0;
  }
  
  double getAverage(int *scores, int size)
  {
  double ttlScore = 0.0;
  double avgScore = 0.0;
  
  ttlScore += *scores;
  avgScore = ttlScore / size;
  
  return avgScore;
  }
  
  void sortArray(int *scores, int size)
  {
  int temp;
  bool swap;
  
      do
      { swap = false;
          for (int count = 0; count &lt; (size - 1); count++)
          {
              if (scores[count] &lt; scores[count + 1])
              {
              temp = scores[count];
              scores[count] = scores[count + 1];
              scores[count + 1] = temp;
              swap = true;
              }
          }
      } while (swap);
  }
  </code></pre>