array of pointer

hallow everyone

how can I find the average from array that is taken 12 values
and how can I find the higher, lower, and equal to the average

using array of pointer
and dynamic array.


I did the array and I input values from user and I display it on black screen
and I stop at that steps above
becase I do not under stand it

- how can I calculate the average? and how can I mace comparison between values in array?

I hope to help me , and if you want me to show my code
I will do it
thank you.
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
int higher = array[0];
int lower = array[0];
int average = array[0];
for (int i = 1; i != 12; ++i)
{
    if (array[i] > higher)
        higher = array[i];
    else
    if (array[i] < lower)
        lower = array[i];
    average += array[i];
}
Last edited on
Thank you @Krogoth
Last edited on
When posting code, please use code tags. Highlight the code and click the <> button to the right of the edit window.

One change: after the loop, add average /= 12;
Please use code tags to make your code readable:

http://www.cplusplus.com/articles/z13hAqkS/

You've been asked to do this before.
@dhayden
which loop did you mean?
here I have 3 for loop;



error LINK1168:cannot open
what is that mean?
Last edited on
which loop did you mean?

The one that computes the average.
Topic archived. No new replies allowed.