*Please utilize C++ format when answering questions 16. Write a function named r
ID: 3626490 • Letter: #
Question
*Please utilize C++ format when answering questions16. Write a function named remove_min_max that has a vector parameter (vector of doubles) .
The function should remove the smallest and largest values from this vector parameter.
For example, when the function is called, if the vector argument has the values,
1.15, 8, 4.5, 1.9, 2.3, -0.7, 100, -4.5, 0, -3.9
then when the function returns, the vector argument will have only the following values,
1.15, 8, 4.5, 1.9, 2.3, -0.7, 0, -3.9
(they do NOT need to be in this order upon return)
Notice that the values 100 (largest) and -4.5 (smallest) were removed.
You are encouraged to write your own helper functions. You may NOT use the erase
member function of the vector class.
Be careful with vectors that do not have 2 or more values. You will lose points for any
bounds errors in your functions.
Explanation / Answer
void remove_min_max(vector<double>& v))
{
double max=v[0],min=v[0];
int ma,mi;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.