Question: Hello, learning c++. Having trouble with this one using vector. I don't want to use the algorithm header to find max and min. so far

Hello, learning c++. Having trouble with this one using vector.
I don't want to use the algorithm header to find max and min.
so far i've written:
#include #include using namespace std;
void getStatus(vector& list);
int main() { vector list; list.push_back(1); list.push_back(2); list.push_back(30); getStatus(list); }
void getStatus(vector& list) { int sum, max, min; max = list[0]; min = list[0]; for (int i = 0; i max) max = list[i]; if (list[i]
im getting an error. Plz help me. I want to know what I did wrong.
Thank you.
Write a C++ function named getStats that has a vector of ints as a parameter and returns a three-element vector of doubles that contains the average of the values, the maximum value, and the minimum value in the incoming vector, in that order. Write the header in such a way that the function cannot alter any values in the vector and that the function does not automatically make a copy of entire incoming vector. Write the body of the function in the most efficient way you can. In a comment above the function list the runtime efficiency (for example 3n2 + 2n + 5) and the growth rate in Big-O notation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
