Write a C++ application that asks the user to enter 10 numbers. The program then stores those numbers in an Array. The program should display the Mean , Median, and Mode.

Mean is the average of the 10 numbers.
Median is the average of the 5th and the 6th numbers. (But you have to arrange the numbers in ascending order first using Bubble Sort before calculating the Median.)
Mode is the most frequent number among the 10 numbers.

can you guys give me the code for this? TIA

We don't give out code here. You need to show some effort of your own and we can help you along the way.

pleaseeeee :'(

First off, we don't do other people's homework for them. Second, we don't do other people's homework for them. And third, we don't do other people's homework for them. Sensing a pattern here yet?

No one here will simply hand you a solution on a silver platter. If you show us what you've done, what you've tried to do, and what problems you've had with it, then we'll be happy to help. If you have specific questions, we can answer them, or at least point you in the right direction. If you have a program with a bug you can't swat on your own, we'll be glad to assist, so long as you pay attention to the forum rules and post sensible questions in an intelligent manner that we have some reasonable hope of answering.

But just cutting and pasting an assignment into a message, without even prefacing it with something like, "I have this homework problem that I can't solve...", is likely to get you booted from the message boards here and elsewhere - if you're lucky. What happens to you if you are unlucky is... well... let's just say that this guy probably won't be trying that again, on that forum or this one.

We take this issue seriously here. Very seriously. Asking us to do homework for you is a grave breach of academic ethics on your part, and actually doing so would be an even bigger breach on ours (not that this stops the many fine mercenaries at Freelancer.com, but still). Simply posting this here, in this way, could get you expelled from your school, if someone happens to notice it and blow the whistle on you. Furthermore, it does neither you nor us any good to help you cheat - especially since there's a good chance some day one of us will have to work with you, manage you, or, Eris forefend, fix code you've written. We have an obligation to our profession and our own future sanity to help you become a good programmer, and doing your coursework for you isn't going to do that.

And please don't insult our intelligence by claiming that it isn't a class assignment. It's very easy to spot one, and we have a lot of practice at it. Trust me on this.

Now, if you actually don't know how to create a program that fits the requirements... hmmmn. Reading the book is definitely called for. As is speaking to the professor; while some can be a--holes about office hours, most are more than willing to give extra help, if only to keep their class grades from slipping to the point where they get re-assigned to teach remedial basketweaving.

Here you go, but don't be supprised if you get an F because your teacher will know at first sight you didn't write it

#include "stdafx.h"
#include <iostream>
#include <cliext/map>
using namespace System;
using namespace std;

void sort(int nums [], int numitems)
{
    for (int i = 0; i < numitems - 1; i++)
    {
        for (int j = i + 1; j < numitems; j++)
        {
            if (nums[i] > nums[j])
            {
                int tmp = nums[i];
                nums[i] = nums[j];
                nums[j] = tmp;
            }
        }
    }
}

int main(array<System::String ^> ^args)
{
    const int maxitems = 10;
    int nums[maxitems] = {4,5,15,4,15,2,9,11,14, 15 };
    sort(nums, maxitems);
    int sum = 0;
    for (int i = 0; i < maxitems; i++)
    {
        sum += nums[i];
    }
    cout << "mean = " << sum << '\n';
    int median = (nums[5] + nums[6]) / 2;
    cout << "median = " << median << '\n';
    cliext::map<int, int> freq;
    for (int i = 0; i < maxitems; i++)
    {
        freq[nums[i]]++;
    }
    int mode = 0;
    int n = 0;
    cliext::map<int, int>::iterator it = freq.begin();
    for (; it != freq.end(); it++)
    {
        if (n < it->second)
        {
            n = it->second;
            mode = it->first;
        }
    }
    cout << "mode = " << mode << '\n';
    return 0;
}

wow that's a good code

what's the difference between:
- using namespace System; and
- using namespace std;

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.