Please send questions to st10@humboldt.edu .
/*--------------------------------------------------
created by smtuttle at Wed Apr 21 14:27:40 PDT 2010
--------------------------------------------------*/
#include <iostream>
#include <cmath>
using namespace std;


/*--------------------------------------------------
 Contract: sum_array : double[] int -> double
 Purpose: expects any array of numbers and how many numbers
//          are in it, and returns the sum of those numbers

 Examples: 
   consider this array:

   const int NUM_WTS = 5;
   double fish_wts[NUM_WTS] = {10, 20.5, 3, 4, 100};

   sum_array(fish_wts, NUM_WTS) == 137.5
--------------------------------------------------*/

double sum_array(double values[], int num_values)
{
    int index = 0;
    double sum_so_far = 0.0;

    while (index < num_values)
    {
        sum_so_far = sum_so_far + values[index];
        index++;
    }

    return sum_so_far;
}