cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
This will mess your mind up
This will mess your mind up
Mar 9, 2013 at 7:10pm UTC
ghostcode
(5)
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?
Mar 9, 2013 at 7:29pm UTC
closed account (
S6k9GNh0
)
Make a test case.
Topic archived. No new replies allowed.