CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2013

    [RESOLVED] How do I call for a for the mean in this situation to get the mean? (C++)

    #include <iostream>
    using namespace std;

    void 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;

  2. #2
    Join Date
    Jan 2006

    Re: How do I call for a for the mean in this situation to get the mean? (C++)

    Sounds like you need to implement the mean1d function.

    By the way, the return type of main should be int, not void. Also, post your code within [code][/code] bbcode tags.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.