473,236 Members | 1,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 software developers and data experts.

Creating a list of multiple element rows, and sorting them.

Daz
Hi everyone.

I am trying to make a program which handles about 70 different objects,
of the same type. The properties are as follows:

std::string ItemName
int ItemType
int Calories
int Weight
int Density

I am looking for a way of sorting the list during the several stages of
their handling.processing, but I don't have a clue where to start. The
list will need to be sorted 3 times, once by Calories, once by Weight,
and then again by Density.

Obviously, I can put each property into a vector, and then sort them,
but this doesn't sort the others into their respective positions (they
need to be handled as rows of data). I am sure that I am either not
realizing the full potential of a vector, or I need to use/create
something else, such as a custom class based on a vector, but I am
really not sure.

I would appreciate any suggestions.

Thanks in advance.

Daz

Jul 2 '06 #1
2 1715
Daz wrote:
Hi everyone.

I am trying to make a program which handles about 70 different objects,
of the same type. The properties are as follows:

std::string ItemName
int ItemType
int Calories
int Weight
int Density

I am looking for a way of sorting the list during the several stages of
their handling.processing, but I don't have a clue where to start. The
list will need to be sorted 3 times, once by Calories, once by Weight,
and then again by Density.
For a small data set like this, you might as well use 3 maps
(std::map<int,Object*>), and you your three sort criteria as the keys.

--
Ian Collins.
Jul 2 '06 #2
Daz

Ian Collins wrote:
For a small data set like this, you might as well use 3 maps
(std::map<int,Object*>), and you your three sort criteria as the keys.

--
Ian Collins
Thanks Ian! I will look into that. :)

Jul 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: bissatch | last post by:
Hi, I am about to write an application that will display all pdf files in a folder and display them by file name in order of date. Is there an easy way of doing this? I was thinking about...
1
by: Craig Banks | last post by:
If a row of data in a dataset has a lot of columns the row displaying the data in a datagrid will run way off the screen. What I'd like to do is display a row of data over several datagrid rows so...
0
by: Patrick.O.Ige | last post by:
I have a datagrid with checkboxes.. When a user clicks one check box and clicks the delete button it deletes that ROw. There another situation when a user clicks multiple rows so i had to loop...
6
by: Adam Tilghman | last post by:
Hi all, I have found that IE doesn't seem to respect the <SELECT> "multiple" attribute when set using DOM methods, although the attribute/property seems to exist and is updated properly. Those...
10
by: moondaddy | last post by:
I'm new to c# and .net 2.0. In the old vb.net 1.1 days I normally created a list class for every business class and used this list class for all databinding rather than using datasets. This is...
1
by: Alan_C | last post by:
Hi, Using Perl I converted a few simple, single header, csv to xml. But I have a csv file that has: Header,row,#1 data_row,under,header_1 nuther_data_row,under,header_1...
0
by: =?Utf-8?B?U3RldmU=?= | last post by:
C# I have a datagrid, and the users are able to select multiple rows and perform an action. This works fine, as I get the rows selected using something like this: CurrencyManager xCM =...
6
by: dufnobles via AccessMonster.com | last post by:
I have a form that excepts text input from a user. I would like to have the form display the same line several times so that the user can enter several different responses on one form screen. ...
2
newnewbie
by: newnewbie | last post by:
I am learning VBA and need a little help with a macro that I am writing. I have a worksheet with data that I split into multiple worksheets based on criteria in one column. E.g. Column A has unique...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.