Thread: Help Please!

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Help Please!


    Write a program that takes 10 floating-point numbers listed most often. The program displays the average of the numbers followed by all of the numbers that are greater than the average. As part of your design, write a method that takes an array of doubles as a parameter and returns the average of the data in the array. Please use methods to do each task. Pass your arrays to the method to complete each task.

    If someone could please help me with this and post the code I would very much appreciate it. Thank you!
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    Originally Posted by jakenbr
    ... and post the code
    Nope, this is not a homework service (no idea why so many people believe that).

    We can help you with your own ideas and your own code, but don't expect anybody to do the work for you.

    // Yeah, and cross-posting won't help. Looks like you actually have to start thinking for yourself.
    Last edited by Jacques1; January 30th, 2013 at 02:07 PM.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Ok how is this


    #include<iostream>
    using namespace std;
    double avg(int a[], int k)
    {
    double sum = 0;
    for(int i=0; i<10; i++)
    sum = sum + a[i];
    return (sum/10.0);
    }

    int main()
    {
    double a[10];
    for(int i=0; i<10; i++)
    {
    cin >> a[i];
    }
    cout << avg(a,10) << endl;
    for(int i=0; i<10; i++)
    {
    if(a[i] > avg(a,10)
    cout << a[i];
    }
    return 0;
    }




    I get multiple error: class, interface, or enum expected, how do I fix this?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    74
    Rep Power
    19
    Nice try Einstein ... What do you think is wrong with it? That is C(++)..... At least copy/paste with proper googling

IMN logo majestic logo threadwatch logo seochat tools logo