Ask Experts Questions for FREE Help !
Ask
    buckboard's Avatar
    buckboard Posts: 1, Reputation: 1
    New Member
     
    #1

    May 9, 2012, 03:01 AM
    What is the best way to sort an array of doubles in ascending order using c++?
    Hi,
    Ive got an array filled with about 2000 different doubles. These are read in from an external .txt. I now want to calculate the median of these numbers. For this I have to sort the array in ascending order. My first attempt was std::sort


    for (I=1; I<2002; I++)
    {
    datenSatz>>zahl;
    daten[i]=zahl;
    std::sort(daten, daten+2002);
    cout<<daten[i]<<endl;
    berechnungen<<daten[i]<<endl;

    }

    and then printing it in a .txt. This works fine, just that the result is pure bogus. It sorts numbers allright, just not mine. Not too sure what it actually does with it.

    Any help?

Check out some similar questions!

Tennis doubles league round robin [ 5 Answers ]

I need a matrix for a 24 player -12 week tennis doubles league. The players are numbered 1-24. Thank you!T Cho

Are ingredients on a food label are listed in ascending order? [ 1 Answers ]

Are ingredients on a food label are listed in ascending order?

Trace a red blood cell from the ascending aorta, through a capillary bed in the left [ 1 Answers ]

Trace a red blood cell from the ascending aorta, through a capillary bed in the left knee, and back through the heart and lungs to the ascending aorta. At each step, name the vessel the red cell is passing through and whether it is currently oxygenated or deoxygenated.

Sort a Column & sum the range with same value during the sort [ 2 Answers ]

Hi, I'm trying to sort a data table by Grades & then sum the totals of the cell with same Grade. The table consists of this headers: Date, DD#, Grade, Bags so what I'm trying to do is to come up with a formula that can sort by Grade & then add the total Bags against that particular Grade and...

Lump sum doubles [ 2 Answers ]

If you deposit money today into an account that pays 6.5 percent interest, how long will it take for you to double your money?


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.