Standard Deviation problem

I am trying to calculate standard deviation of all the elements in a vector, so far I have:

Code:

` double x;`

double squared_sum;

double squared;

for (int i = 0 ; i < num.size () ; i++ )

{

x = num[i] - mean; // mean = 4.2857

squared = x*x;

squared_sum += squared;

}

cout << "squared_sum" << x << endl;

But when I run this I get something like: **squared_sum.#INF**

What seems to be the problem and haw can I fix this?

The numbers in the vector are: 2 5 3 2 10 1 7

calculating the stardard diviation

i think the problem is that you haven't initialised your variables therefore set

Quote:

squared_sum=0;

square=0;