Thread
:
Logic error, simple stat prog
View Single Post
•
•
Join Date: Jul 2008
Posts: 2,001
Reputation:
Solved Threads: 343
ArkM
Offline
Postaholic
Re: Logic error, simple stat prog
0
#
6
Dec 1st, 2008
1. That's because the modification (improvement) of getSmallest and getLargest functions was incorrect. It was wrong solution to assign a role of for loop counter to output parameter count (why "count" if it's an index of? ). Think: the 1st count value is 1 (must be 0) and the last is 12 (then you add 1 and print 13). Make obvious correction.
2. Look again to getAverage code: it's WRONG!!!
Ooh, that's right code:
Help with Code Tags
c++ Syntax
(
Toggle Plain Text
)
double
getAverage
(
double
array
[
]
,
int
size
)
{
return
getTotal
(
array,size
)
/ size;
}
double getAverage(double array[], int size) { return getTotal(array,size) / size; }
ArkM
View Public Profile
Find all posts by ArkM