View Single Post
Join Date: Oct 2008
Posts: 22
Reputation: Foe89 is an unknown quantity at this point 
Solved Threads: 0
Foe89 Foe89 is offline Offline
Newbie Poster

Re: Logic error, simple stat prog

 
0
  #10
Dec 1st, 2008
Figured it out

  1. double getLargest(double array[], int size, int &i)
  2. {
  3. double largest = array[0];
  4.  
  5. for (int count = 0; count < size; count++)
  6. { if (array[count] > largest)
  7. {largest = array[count];
  8. i = count;}
  9. }
  10. return largest;
  11.  
  12. }
  13.  
  14.  
  15. double getSmallest(double array[], int size, int &i)
  16. {
  17. double smallest = array[0];
  18.  
  19. for (int count = 0; count < size; count++)
  20. { if (array[count] < smallest)
  21. {smallest = array[count];
  22. i = count; }
  23. }
  24. return smallest;
  25. }
Reply With Quote