G
Gary Wessle
Hi
which container I can use to do the following,
I have a data file looking like
name age
jack 32
sam 12
sue 44
I need to sort them by age so that it would be
sam 12
jack 32
sue 44
I don't think map will let me sort its values, do I need to something
like this?
class mytype
{
string name;
int age;
public:
mytype(string n, int a){}
}
mytype jack("jack",32);
mytype sam("sam",12);
mytype sue("sue",44);
vector<mytype> groupA;
groupA.push_back(jack);
....
****************
how do I sort groupA by age?
****************
thanks
which container I can use to do the following,
I have a data file looking like
name age
jack 32
sam 12
sue 44
I need to sort them by age so that it would be
sam 12
jack 32
sue 44
I don't think map will let me sort its values, do I need to something
like this?
class mytype
{
string name;
int age;
public:
mytype(string n, int a){}
}
mytype jack("jack",32);
mytype sam("sam",12);
mytype sue("sue",44);
vector<mytype> groupA;
groupA.push_back(jack);
....
****************
how do I sort groupA by age?
****************
thanks