int sum( const vector <int> & v ) { /*your code here */ }Note -- this function outputs nothing. It silently returns the sum to the main program that does this
cout << sum(v) << "\n";
double mean(const vector <int> & v) { /*Your code here*/ }Hint: mean(...) should call sum(...) and use code like this:
return sum(v)/static_cast<double>(v.size());Note: the algorithm is similar but simpler than the one you used in lab07 because you know the size of the vector. Again -- the "cout" should be outside the function and the mean is returned.
int max(const vector <int> & v) { /*Your code here*/ }
int min(const vector <int> & v) { /*Your code here*/ }
int range(const vector <int> & v) { /*Your code here*/ }Return max(v)-min(v).
double variance( const vector <int> & v ) { /*your code here */ }
double sd( const vector <int> & v ) { /*your code here */ }Note -- Formulas for standard deviation are on page 154 of Horstmann & Budd.
. . . . . . . . . ( end of section Process) <<Contents | End>>
vector <string> grid;and use it to plot functions. It should be like the experiments you did in [ ../lab08/ ] but you can display the graphs the right way up: x horizontally and y = f(x) vertically. Note: you can borrow some code from [ lab08/ ] .... but I figure you've got about 60 minutes work to do for this project.