Results 1 to 5 of 5

Thread: sorting an array of doubles [solved]

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2012
    Posts
    57
    Thanks
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default sorting an array of doubles [solved]

    Hi,

    I was asking about sorting doubles but i seem to have found the answer. Thanks.

    Qt Code:
    1. //-------------------------------------------------------------------------------
    2. void sortdoubles(double *d, int num)
    3. {
    4. QList<double> tmp;
    5. for (int i = 0; i < num; i++)
    6. tmp << d[i];
    7. qSort(tmp);
    8. for (int i = 0; i < num; i++)
    9. d[i] = tmp.at(i);
    10. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Cremers; 24th September 2018 at 16:04.

Similar Threads

  1. How to parse nested JSON Array and Object inside array
    By Radhika in forum General Programming
    Replies: 5
    Last Post: 17th December 2015, 08:42
  2. tableview with doubles
    By Arend in forum Newbie
    Replies: 2
    Last Post: 26th November 2012, 06:43
  3. Cast QString array to std::string array
    By Ishtar in forum Newbie
    Replies: 4
    Last Post: 15th July 2011, 08:28
  4. Replies: 2
    Last Post: 12th November 2010, 14:42
  5. declare an array of QSemaphore and array of slot functions
    By radeberger in forum Qt Programming
    Replies: 11
    Last Post: 2nd May 2010, 13:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.