I'm writing a program for class where employee names and pays are read from an input file into arrays. How would I go about writing the code to get this function to display the correct name from the array for the employee with the largest pay check? The function itself works as far as determining which value is the largest, I'm just drawing a blank on how to cout the correct name.
I would assume that, say, fname[3] goes with lname[3] goes with actualPay[3]. So you need to save the index where you found the biggest pay. Make a new variable for this. Also, if you're trying to print the highest paid, don't call the function 'sort', call it something like 'printHighestPaid'.