snesnerd's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
26 (0.04 per day)
Joined:
14-June 12
Profile Views:
334
Last Active:
User is offline Aug 02 2012 12:23 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   snesnerd has not set their status

Posts I've Made

  1. In Topic: Finding the mean of one row of a 2D array

    Posted 2 Aug 2012

    Do you know how to find the minimum and maximum of the entire array?
    In a 1D array yes, but not a 2D array.

    Did you show me the contents of your array before your "sort"? No you didn't.
    The contents of the array is always different since random numbers are always being generated.

    Did you show me the contents of your array after your "sort"? No you didn't.
    Again same as question 2.

    Did you show me what you thought the median should be? No you didn't.
    I explained what the median is. I cant really tell you the exact median if the numbers are random.

    Did you show me what your program computes the median to be? No you didn't.
    Its always a different number.

    I mean if you look at my earlier posts with the whole program, putting the median with the mean is pretty much what I am going after here. I am shooting for the program telling me the mean,median, and range of one row the user chooses.
  2. In Topic: Finding the mean of one row of a 2D array

    Posted 2 Aug 2012

    Okay. Let me start with the snippet of code you posted. You asked me what the purpose was of that snippet. The point of that snippet was to bubble sort the row the user chose because the Median of a given set of numbers is the middle number, but the numbers have to be in order. The values in my array are randomly generated numbers between 1 and 100 so I cant exactly tell you what the exact numbers will be. Now even though this is a 2D array the user chooses one row they would like to find the Median of. This row can be thought of as being 1D now. In 1D the Median is like I said earlier. I hope I was able to answer all your questions.
  3. In Topic: Finding the mean of one row of a 2D array

    Posted 2 Aug 2012

    No I want to find the Median and the Range of a single row the user chooses from a 2D array. My attempt at finding the Median was above. And I have no clue how to find the Range of a row the user chooses in a 2D array.
  4. In Topic: Finding the mean of one row of a 2D array

    Posted 2 Aug 2012

    Thanks for the help everyone especially skydiver. My variables were mixed up and after I fixed them I was able to get the Mean of a single row. I hate to keep asking questions but your knowledge is just so helpful. Now I just want to calculate the Median and Range of a single row the user chooses. I have been messing around with the Median and have obtained what you see below. It does give me a number but the wrong one. And then as for Range, I have no clue how to pick out the biggest and smallest number within a row the user chooses to find the range.

    float Median;
    
                for (int j = 0; j < n; j++)
                {
                    for (int k = 0; k < j; k++)
                    {
                        if (array[i][j] < array[j][k])
                        {
                            int temp = array[i][j];
                            array[i][j] = array[j][k];
                            array[j][k] = temp;
                        }
                    }
                }
    
                    if (n % 2 == 0)
                    {
                        for (int j = 0; j < n; j++)
                        Median = ((array[i-1][j]/2) + (array[i-1][j]/2)-1)/2;
                        cout << "The Median of row " << i << " = " << Median << ".\n";
    
                    }
    
                    if (n % 2 != 0)
                    {
                        for (int j = 0; j < n; j++)
                        Median = array[i-1][j]/n;
                        cout << "The Median of row " << i << " = " << Median << ".\n";
                    }
    
  5. In Topic: Finding the mean of one row of a 2D array

    Posted 2 Aug 2012

    Well I did have rows be m and columns be n. Now i and j are reversed where in my case i is associated with the column. Is that really the problem as to why the mean comes out weird sometimes? Where am I making my mistake at then?

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Comments

snesnerd has no profile comments yet. Why not say hello?