Can anyone tell me why my program is outputting an extra line at the end of my file? Also I am not sure how to sort this data alphabetically and keep the phone number with the correct name, cany anyone help me?
In the line right before the return 0, you are outputting a newline.
To sort alphabetically, you should create a data structure to hold the phone number, first name, and last name. Then, create an array of those data structures and fill it with data. Sort the array by name, and output the data.