okay so here's my code but i knwo there's just something so wrong with the second/youngest one. the first/oldest part works though.
int oldest = 0;
// Determine and print oldest employee(s):
for (int i=0; i<recordlist.size(); i++) {
if (recordlist[i].age > oldest){
oldest = recordlist[i].age;
}
}
cout << "Oldest employee(s): "
<< endl;
for (int o=0; o<recordlist.size(); o++) {
if (recordlist[o].age == oldest) {
cout << "\t" << recordlist[o].name << "; " << recordlist[o].age << endl;
}
}
cout << endl;
// Determine and print youngest employee(s):
int youngest=0, y=0; int u=0; //****************************************
for (int u=recordlist.size(); recordlist[u].age>recordlist[u-1].age; u--) {
youngest=recordlist[u].age;
if (recordlist[u-1].age < youngest){
youngest = recordlist[u-1].age;
}
}
cout << "Youngest employee(s): "
//<< recordlist[o].name << "; " << recordlist[o].age
<< endl;
for (int y=0; y<recordlist.size(); y++) {
if (recordlist[y].age == youngest) {
cout << "\t" << recordlist[y].name << "; " << recordlist[y].age << endl;
}
}
cout << endl;