how to sort parallel arrays in c++?
From: Xiaozhu (gee.ygary3_at_gmail.com)
Date: 08/31/04
- Next message: Kay: "Linked list"
- Previous message: Bob Hairgrove: "Re: using memcpy to copy classes"
- Next in thread: Victor Bazarov: "Re: how to sort parallel arrays in c++?"
- Reply: Victor Bazarov: "Re: how to sort parallel arrays in c++?"
- Reply: Alf P. Steinbach: "Re: how to sort parallel arrays in c++?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Aug 2004 09:53:40 -0700
say, if you had parallel arrays containing the sales person id, the month, and
the sales figures (for that person in that month), sorting on sales figure and
preserve the order of figures within the data about the same person:
Original Data:
id month sales
+-----+ +-----+ +-----+
| 432 | | 8 | | 89 |
+-----+ +-----+ +-----+
| 123 | | 8 | | 116 |
+-----+ +-----+ +-----+
| 555 | | 8 | | 203 |
+-----+ +-----+ +-----+
| 432 | | 9 | | 105 |
+-----+ +-----+ +-----+
| 123 | | 9 | | 143 |
+-----+ +-----+ +-----+
| 555 | | 9 | | 187 |
+-----+ +-----+ +-----+
Sorted by sales:
id month sales
+-----+ +-----+ +-----+
| 432 | | 8 | | 89 |
+-----+ +-----+ +-----+
| 432 | | 9 | | 105 |
+-----+ +-----+ +-----+
| 123 | | 8 | | 116 |
+-----+ +-----+ +-----+
| 123 | | 9 | | 143 |
+-----+ +-----+ +-----+
| 555 | | 9 | | 187 |
+-----+ +-----+ +-----+
| 555 | | 8 | | 203 |
+-----+ +-----+ +-----+
is that possible to do this in c++? Thanks!
- Next message: Kay: "Linked list"
- Previous message: Bob Hairgrove: "Re: using memcpy to copy classes"
- Next in thread: Victor Bazarov: "Re: how to sort parallel arrays in c++?"
- Reply: Victor Bazarov: "Re: how to sort parallel arrays in c++?"
- Reply: Alf P. Steinbach: "Re: how to sort parallel arrays in c++?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|