CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Thread: How do I implement the mean1d function to find the mean in this code?

1. Junior Member
Join Date
Nov 2013
Posts
2

How do I implement the mean1d function to find the mean in this code?

Code:
```#include <iostream>
using namespace std;

int main()
{

//I'll be making a 1 dimensional array
int array1d[25];

array1d[0] = 9;
array1d[1] = 8;
array1d[2] = 7;
array1d[3] = 5;
array1d[4] = 3;
array1d[5] = 7;
array1d[6] = 4;
array1d[7] = 7;
int array1d_size = 8;

cout << "The original array is: { ";
for (int i=0; i<array1d_size; i++)
cout << array1d[i] << " ";
cout << "} " << endl;

double the_mean = mean1d(array1d, array1d_size);
cout << "\n=====> The mean is: " << the_mean;

}```
Last edited by BrandenBTW; November 2nd, 2013 at 10:52 AM.

2. Elite Member Power Poster
Join Date
Jan 2006
Location
Singapore
Posts
6,739

Re: How do I implement the mean1d function to find the mean in this code?

What do you understand by "arithmetic mean"? From there, you should have an idea of how to implement it.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

Click Here to Expand Forum to Full Width