/* Function to find the mean value in a vector. Receive: vec, a nonempty vector Return: the mean of the values in vec Note: Must #include to use accumulate() ----------------------------------------------------------*/ double mean(const vector & vec) { if ( vec.empty() ) { cerr << "\n***mean(vector): vector is empty!" << endl; return 0.0; } else return accumulate(vec.begin(), vec.end(), 0.0) / vec.size(); }