Why are you reading from two files? Isn't the data all in one file?
If that's the case, then you will need an array (or vector) of person records.
You will need to read the data file adding each record to the array until you reach end of file.
You will then need to sort the array.
Not going to write the code for you. We don't do homework. If you run into problems, post back and we will try and help.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.