I have this function in a separate file to be called in the main program. I know that i have to have a for statement under the first one where i already figured the sum. Please help.

Code:

//-----------------------------------------------------------------------------
// deviation function
//
//-----------------------------------------------------------------------------
#include <cmath>
double deviation(double list[], int size)
{
double total=0;
double average;
double S;
double U;
double sum;
for(int x = 0; x<size; x++){
total += list[x];
}
average = total/size;
for(
S = (sqrt (U / size));
return S;
}