/*--------------------------------------------------
created by smtuttle at Tue Nov 29 14:09:22 PST 2016
--------------------------------------------------*/
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;


/*--------------------------------------------------
 signature: sum_array : double[] int -> double
 purpose: expects an array of doubles and its size,
	   and returns the sum of those elements in
	   that array

 examples: if I have:
     const int NUM_VALS = 5;
     double my_list[NUM_VALS] = {10, 20, 3, 4, 100.1};
     then:
 
     sum_array(my_list, NUM_VALS) == 137.1
 
     and if I have:
     const int NUM_WTS = 3;
     double worm_wts[NUM_WTS] = {10, 20, 30};
 
     then:
 
     sum_array(worm_wts, NUM_WTS) == 60
--------------------------------------------------*/

double sum_array(double values[], int values_size)
{
    double sum_so_far = 0;

    for (int index = 0; index < values_size; index++)
    {
        sum_so_far = sum_so_far + values[index];
    }

    return sum_so_far;
}