Well, not a word of thanks (or disapproval, or any response at all) for my previous contribution. It's very difficult to help someone without having a two-way dialogue.
You made various changes to the code I suggested. That's fine, you are free to do so. However, I'm not sure what functionality has been gained in so doing. If you could explain why you are approaching the while loop at line 95
while (inFile)
in this particular way, rather than my suggestion of
while (choice != 'Q' && choice != 'q')
then things might be come clearer on all sides.
To return to your question,
I cannot figure out how I would display it in reverse order (from the bottom of the text file up), find the average age, display the oldest animal, or display the youngest animal. |
I would suggest that all of these operations are fairly straightforward if your starting point, rather than a file, is an array.
For example, to display in reverse order, simply step through the array from the last row to the first. To find the average age, step through the array, add up the total of all the ages and divide by the number of rows. To find the oldest animal, step through the array, find the row with the greatest age, and display the details for that row, and so on.
Of course each of those tasks may be broken down into more detail as required.