//----------------------------------------------------------------------------
//----Write a program that reads in a list of people's names and ages,
//----and writes them out in alphabetical order by name.
//----------------------------------------------------------------------------
#include <iostream.h>
#include "nameageclass.h"
//----------------------------------------------------------------------------
int main(void) {

person Person1,
    Person2,
    TempPerson;

//----Prompt user for names and ages, and read
Person1.Read("first");
Person2.Read("second");

//----Compare last names and swap if out of order
if (Person1 > Person2) {
    TempPerson = Person1;
    Person1 = Person2;
    Person2 = TempPerson;
    }

//----Output the names and ages
cout << "In alphabetical order by last name they are:" << endl;
Person1.Write();
Person2.Write();

//----End program
return(0);
}
//----------------------------------------------------------------------------
