I need help in writing two classes, Person and Personlists, where I am supposed to gather the attributes of persons and then allow them to be sorted by a given attribute, printing out the result. Here is what I have done so far:
Code:
class Person {
int height;
int weight;
int age;
int IQ;
public:
Person (int height = 0, int weight = 0, int age = 0, int IQ = 0) {
this->height = height;
this->weight = weight;
this->age = age;
this->IQ = IQ;
}
void find( int attribute = 0) ; //Thinking of creating a method //that allows me to sort by a given attribute but am stuck
void print() {
cout<<height;
cout<<weight;
cout<<age;
cout<<IQ;
}
};
class Personlists {
//This class too I am lost for ideas as to what I can do with it
};
int main() {
class Person p1(179, 75, 30, 100);
p1.print();
return 0;
}