// person.cc #include #include "person.hh" void Read(Person& t) { cout << endl; cout << "Person: " << endl; cout << " name : "; cin >> t.name; cout << " Geburtstag tt mm jjjj : "; cin >> t.geburtstag.tag >> t.geburtstag.monat >> t.geburtstag.jahr; cout << " Gehalt : "; cin >> t.gehalt; return; } void Print(const Person& t) { cout << endl; cout << "Person: " << endl; cout << " name : "; cout << t.name << endl; cout << " Geburtstag tt mm jjjj : "; cout << t.geburtstag.tag << "." << t.geburtstag.monat << "." << t.geburtstag.jahr << endl; cout << " Gehalt : "; cout << t.gehalt << " Euro" << endl; cout << endl; return; } int AgeComp(const Person& a, const Person& b) { int isyoung; Datum da = a.geburtstag, db = b.geburtstag; // temp. Var. erleichtern Lesbarkeit if ( da.jahr != db.jahr ) { isyoung = ( da.jahr < db.jahr ) ? OLDER : YOUNGER; } else if ( da.monat != db.monat ) // Gleiches Jahr ==> weiter mit Monat { isyoung = ( da.monat < db.monat ) ? OLDER : YOUNGER; } else if ( da.tag != db.tag ) // Gleicher Monat ==> weiter mit Tag { isyoung = ( da.tag < db.tag ) ? OLDER : YOUNGER; } else // bleibt bloss noch gleicher Geburtstag uebrig { isyoung = EQUAL_AGE; } return isyoung; } void Sort(const int n, const Person a[], int idx[]) { int i, j, maxIdx, temp; for (i=0; i