This will mess your mind up

The following fuction from a class is supposed to count the number less then the average of all number combined. but it does not do that, now the fun part if you change it to count the number greater then the average it works great.

void IntegerArray::countBelowAverage()
{
avrg=calcAverage(avg);

int count=0;
for(int x=0; x<100; x++)
{
if (list[x]<avrg)
{
count++;
}
}
numBelowAvg=count;
}

any suggestion on how to fix it to do the correct job?

One other question how do i get this to post in the proper format?
closed account (S6k9GNh0)
Make a test case.
Topic archived. No new replies allowed.