title: Trying to find the lowest number in my array, used the same line for highest number
body: <p>Basically what I am trying to do is get the lowest number, but the program is feeding me back garbage, but I use the same line of code to get the highest value, only change I made was > to &lt;, the program gives me back the highest value no problem put not the lowest. And I have tried everything I can think of from making the lowest= x[0], lowest=101( user is suppose to enter in grades on scale of 0-100, thought made it had something to do with the value. ) and lowest =highest and it still give me back a number like -9.255596e...., any help or suggestion or greatly appreciated, or maybe a point in the right direction just really trying to understand why it works for one set of numbers and not the others.</p>
  
  <pre><code> #include "stdafx.h"
   #include &lt;iostream&gt;
  
   using std::cout;
   using std::endl;
   using std::cin;
  
   double average(double,int);
   double sum1(double[],int);
   double highest(double[], int);
   double lowest(double[], int);
  
   int _tmain(int argc, _TCHAR* argv[])
  {
  
      double gradeBook[1000];
      char x;
      int count = 0;
      cout &lt;&lt; "Do you wish to start the program if so enter y to stop enter q" &lt;&lt; endl;
      cin &gt;&gt; x;
      while (x != 'q')
      {
          cout &lt;&lt; "Enter in test grade on a scale of 0 to 100" &lt;&lt; endl;
          cin &gt;&gt; gradeBook[count];
          if (gradeBook[count]&lt;0 || gradeBook[count]&gt;100)
          {
              cout &lt;&lt; " Please try again ";
              count--;
          }
          else
              cout &lt;&lt; "valid answer" &lt;&lt; endl;
          count++;
           cout &lt;&lt; "Do you wish to continue entering in grades? If so enter y to      stop enter q" &lt;&lt; endl;
          cin &gt;&gt; x;
       }
  
           highest(gradeBook, count);
       cout &lt;&lt; "The highest grade enter is " &lt;&lt; highest(gradeBook, count) &lt;&lt; endl;
       lowest(gradeBook, count);
       cout &lt;&lt; "The lowest grade enter is " &lt;&lt; lowest(gradeBook, count) &lt;&lt; endl;
  
      cout &lt;&lt; lowest &lt;&lt;endl;
  
  
      return 0;
  }
  
  
      double highest(double x[], int y)
  
      {
       double highest = 0;
      for (int i = 0; i&lt;= y; i++)
      {
      if (x[i]&gt;highest)
      highest = x[i];
      }
      return highest;
  
      }
      double lowest(double x[], int y)
      {
      double lowest = 100;
  
      for (int i = 0; i&lt;= y; i++)
      {
          if (x[i]&lt; lowest)
              lowest = x[i];
      }
      return lowest;
  }
  </code></pre>