I simply cannot figure out how to get my program to incorporate the methods for min and max. i know that the min is array [0] and max is array [n]how do i programthat properly??
Your question is vague - what is your program supposed to do exactly?
And I don't see int v[] and int n actually declared anywhere. I doubt your code even compiles. And if (i<i+1) will always be true, why bother with an if statement? And if you know what min and max are why do you need to calculate them?
it compiles without the last 2 methods calcMax and calcMin. I don't know what to put in the 2 methods in order to output the max and min values the user inputs. i know they are simply the 1st and last numbers in the method for sorting them
my program needs to output mean,median,max,min through separate methods. therefore, i don't know what to put into the max and min methods so i can output the min and max in the main as i have the mean and median working. the i<i+1 i clearly am confused at that point and don't know what to do in the two methodsfor the max and min
Where are int v[] and int n declared/initialized? Is this all your code or only part? I can't follow the logic of your code unless I can see all of it.
agnophilo look at his code..they are the parameters of his functions calcMax and calcMin.
and as far as max and min..there is this really neat function in the algorithm header called max_element , min_element.
for your calcMax do something like this. return( std::max_element( v.begin() , v.end() ); );
instead of what you have and the same thing but with min_element for your calcMin.
"agnophilo look at his code..they are the parameters of his functions calcMax and calcMin."
I know, I was asking where they are initialized and where the rest of the code is.
"and as far as max and min..there is this really neat function in the algorithm header called max_element , min_element."
I see no header file, nor do I see min_element anywhere. I may be being stupid here, I know nothing about header files (aren't they name.h files that were a C thing, not C++?).
"ps agnophilo when you call a function you do not have to have same parameter names as the prototype only the same type of objects. "
they are under the algorithm library part of the stl container
I sent the links to them. And you can use .h headers in c++ but most people use .hpp I just meant it as a precompiled library I forgot what they are called.