|
-
April 6th, 2009, 06:39 PM
#16
Re: Newbie learning sorting algorithms and arrays
yea i probably didn't, thanks for your help
-
April 7th, 2009, 09:08 AM
#17
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?
Last edited by peste19; April 10th, 2009 at 12:43 PM.
-
April 10th, 2009, 12:37 PM
#18
Re: Newbie learning sorting algorithms and arrays
-
April 10th, 2009, 12:44 PM
#19
Re: Newbie learning sorting algorithms and arrays
 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
-
April 10th, 2009, 12:59 PM
#20
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
-
April 10th, 2009, 02:31 PM
#21
Re: Newbie learning sorting algorithms and arrays
 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
Last edited by Paul McKenzie; April 10th, 2009 at 02:34 PM.
-
April 12th, 2009, 02:38 PM
#22
Re: Newbie learning sorting algorithms and arrays
Last edited by peste19; April 12th, 2009 at 03:05 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|