title: C++ getting highest test score and using pointers
body: <p>created a program to prompt the user to enter test scores and find the average, highest, and sort the test score. I am having problems  I cant seem to get the higest test scores from the function I made and when I created the sorting test score function the program crashes. Can someone look at my functions and see where my problem is, I seem to get the average test score to show.</p>
  
  <pre><code>double getAverage(double*, int);
  double gethighest(double*, int);
  double getlowest(double*, int);
  void arrayAscending(double*, int);
  
  int main()
  {
      // Variable declarations
      double *testScores; // Dynamically allocate an array of test scores
      double average, highest, lowest;     
      int numTests;       // Number of test scores
      int count;          // Counter variable
  
                          // Get the number of tests
      cout &lt;&lt; "How many tests do you wish to process? ";
      cin &gt;&gt; numTests;
  
      // Verify input is not a negative number
      while (numTests &lt;= 0)
      {
          // Get input again.
          cout &lt;&lt; "Please enter a positive number:  ";
          cin &gt;&gt; numTests;
      }
  
      // Dynamically allocate an array large enough to hold the test scores
      testScores = new double[numTests];
  
      // Get the specified number of test scores
      cout &lt;&lt; "Enter the test scores below.\n";
      for (count = 0; count &lt; numTests; count++)
      {
          cout &lt;&lt; "Test " &lt;&lt; (count + 1) &lt;&lt; ": ";
          cin &gt;&gt; *(testScores + count);
  
          // Verify input is not a negative number
          while (*(testScores + count) &lt; 0)
          {
              // Get input again.
              cout &lt;&lt; "Please enter a valid test score.\n";
              cin &gt;&gt; *(testScores + count);
          }
      }
  
      // Calculate the average test score
      average = getAverage(testScores, numTests);
      highest = gethighest(testScores, numTests);
      lowest = getlowest(testScores, numTests);
      // Display the results.
  
      arrayAscending(testScores, numTests);
  
      cout &lt;&lt; endl;
      cout &lt;&lt; "The average of those scores is:  " &lt;&lt; average &lt;&lt; endl;
  
      cout &lt;&lt; "The higest of those scores is: " &lt;&lt; highest &lt;&lt; endl;
      cout &lt;&lt; "The lowest of those scores is: " &lt;&lt; lowest &lt;&lt; endl;
  
      // Free dynamically allocated memory
      delete[] testScores;
      testScores = 0;     // Make testScores point to null
      return 0;
  }
  
  //function getAverage - calculates the average of the test scores
  double getAverage(double* scores, int num)
  {
      double avg;
      double total = 0.0;
      for (int count = 0; count &lt; num; count++)
      {
          total += scores[count];
      }
      avg = total / num;
      return avg;
  }
  
  double gethighest(double* scores, int num)
  {
      double highnum = 0.0;
  
      for (int i = 0; i &lt; num; i++)
      {
          if (scores[i] &gt; highnum)
              highnum = scores[i];
  
      }
      return highnum;
  }
  
  double getlowest(double* scores, int num)
  {
      double lowestnum = 100;
  
      for (int i = 0; i &lt; num; i++)
      {
          if (scores[i] &lt; lowestnum)
              lowestnum = scores[i];
      }
      return lowestnum;
  }
  
  void arrayAscending(double *array, int size)
  {
      int startScan, minIndex;
      double minElem;
  
      for (startScan = 0; startScan &lt; (size - 1); startScan++)
      {
          minIndex = startScan;
          minElem = array[startScan];
          for (int index = startScan + 1; index &lt; size; index++)
  
          {
              if ((array[index]) &lt; minElem)
              {
                  minElem = array[index];
                  minIndex = index;
              }
          }
          array[minIndex] = array[startScan];
          array[startScan] = minElem;
      }
  }
  </code></pre>