#include<iostream>
using namespace std;


// Pre-conditions: pre-initialized list of floats
// with size specified by second input
// Post-condition: outputs sum of all elements in list
float sumArray(float array[], int size);


int main()
{
 // initialize list of numbers
 float list[5]={2.5, -1.5, 0, 15.4, -3.5};

 // output sum of list
 cout << sumArray(list,5);

 return 0;
}


// Function to compute sum of input list
float sumArray(float array[], int size)
{
 float result=0;

 // add each array element to runing sum
 for(int i=0; i<size; i++)
   result+=array[i];

 return result;
}