Line 55: you loop entire array. On line 45 you did loop only the part that has salaries ...
display salaries above the average |
You display on line 60 the integer 'high'. That is not "a salary that is above average".
You should:
IF salary is above average THEN display it
display the percentage of salaries above the average |
On line 63 you pick one salary and divide it by number of salaries. How is that "percentage of numbers"?
Tip: if you divide integer with integer, then the result is integer; remainder is discarded. Since all salaries can't be "above average", the percentage is less than 100%. a/b, where a<b is 0.
If either operand is a float, then division is different and produces a float.
One can force that:
static_cast<float>(a) / b
However, while static_cast<float>(3)/4 is about 0.75, you should not show "0.75%". That is a tiny amount. We expect to see "75%". 300/4 is 75, isn't it?