Re: Newbie learning sorting algorithms and arrays
yea i probably didn't, thanks for your help
Re: Newbie learning sorting algorithms and arrays
additional requirement is to calculate median but i have been hitting always on the same point, i cant think of any logic to add this to my program, anyone have ideas how to get these from the data?
Re: Newbie learning sorting algorithms and arrays
Re: Newbie learning sorting algorithms and arrays
Quote:
Originally Posted by
peste19
additional requirement is to calculate mode,median but i have been hitting always on the same point, i cant think of any logic to add this to my program, anyone have ideas how to get these from the data?
Learn to write functions, and then just call them with the appropriate arguments.
Code:
double CalculateMean(double *yourData, int numberOfData)
{
// you fill this in
}
double CalculateMedian(double *yourData, int numberOfData)
{
// you fill this in
}
double CalculateMode(double *yourData, int numberOfData)
{
// you fill this in
}
int main()
{
//....
cout << "The mean is " << CalculateMean(grade, 12) << "\n";
//.. etc...
}
Regards,
Paul McKenzie
Re: Newbie learning sorting algorithms and arrays
I know how to create the module, my issue is i just cant make it work in my head how to write the statement
Re: Newbie learning sorting algorithms and arrays
Quote:
Originally Posted by
peste19
I know how to create the module, my issue is i just cant make it work in my head how to write the statement
It isn't a statement.
First, do not edit your original post about what you need to do. This makes my post to you lose its meaning. What exactly do you need to compute? Whatever that is, how do you do it with pencil and paper?
Regards,
Paul McKenzie
Re: Newbie learning sorting algorithms and arrays