min/max, mean, median.

Pages: 123
i dont know, how to do that?

Just loop each over each element of the vector, and and sum the values of those elements. Then divide that sum by the number of elements.
I would store the results in vector(s). That keeps calculation separate from output.

When all the max are in one vector and min in other, it is easy to output all max as one line and the all the min as second line. Thus, the max and min of column k will form the column k of the output.


One has to remember that an input column may have no values at all. You cannot calculate anything for nothing and therefore your program has to cover that special case too.


I have posted on this thread code that calculates min, max and mean for a vector. However, they are such beginner operations that one should have mastered those well before one did embark on this task that involves input of multiple vectors.
Topic archived. No new replies allowed.
Pages: 123