C++, calculates the mean and standard deviation of an array