Completed the implementation of the sample variance function in C++