DoubleVectorOps.cpp
// DoubleVectorOps.cpp defines common operations for vector<double>.
//
// Begun by: Joel Adams, for Hands On C++.
// Completed by:
// Date:
//*******************************************************************
#include <iostream>
#include <vector>
#include "DoubleVectorOps.h"
using namespace std;
//**********************************************************
// ostream output *
// Receive: out, an ostream containing a list of values, *
// vec, the vector<double> to be displayed. *
// PRE: vec.size() == the number of values in out. *
// Passback: out, with a list of values extracted from it, *
// vec, containing those values. *
// Return: out, for chaining. *
//**********************************************************
ostream & operator<<(ostream & out, const vector<double> & vec)
{
for (int i = 0; i < int(vec.size()); i++)
out << vec[i] << ' ';
return out;
}
//****************************************
// Compute the mean of a list of numbers.*
// Receive: theVec, the list of numbers. *
// PRE: theVec.size() > 0. *
// Return: the mean value. *
//****************************************
// replace this line with a definition of Average()
//***************************************************
// Compute standard deviation of a list of numbers. *
// Receive: theVec, the list of numbers. *
// PRE: theVec.size() > 0. *
// Return: the standard deviation of the list. *
//***************************************************
// replace this line with a definition of StandardDev()
|