I don't know what you learned in class, but the basic rule when you are reading from a file is: the read statement should be your while conditional, e.g.
tunnel>>myVar calls a function that reads data into myVar and then returns the object tunnel, leaving you with:Code:while(tunnel>>myVar) { }
while(tunnel)
The tunnel object will evaluate to false in the while conditional if any errors have occured that will prevent you from reading anymore data from the file. eof is considered an error, so the while loop will terminate correctly when you reach the end of the data without having to count the data.
However, there are other possible errors that can occur while reading from a file. If one of those errors occurs, your current while loop will try to keep reading data because it hasn't encountered eof yet(and the counter hasn't reached 17)--but the error will prevent you from reading any data, and you won't know that you aren't reading in data. After the loop terminates due to the counter reaching its max, you'll think you successfully read in 17 lines of data. If you put the read statement in the while conditional instead, the loop will end immediately if there's any error, so you can check a counter to see if you read in 17 pieces of data and therefore you are good to go.
By the way, the instructions say the data is in ascending order by flight angle, so while your maxval() and minval() functions would apply to data that isn't ordered, the minimum angle is actually just the first angle in the data file, and the max angle is the last angle in the data file. Your instructor apparently wanted to make the assignment easier and eliminated the need to write those functions. If I were you, I would read the data into a two dimensional array. Row 0 will have the angle in column 0 and the lift in column 1, row 1 will have the next angle in column 0, and the next lift in column 1, and so forth.
Then prompt the user to enter an angle. After that, check that the angle is within the range: if it isn't display an error message, and prompt them again. If it is within the range, then start at row 0 in your array and check to see if the angle in column 0 is larger than the given angle. Check the rows until you find the first row whose angle is larger than the given angle. Record that row number. The angle that is lower than the given angle will be the recorded row number minus 1. That will give you the two rows whose angles surround the given angle. The lifts are in the second column of each of those rows. Then you do the math to find the lift and display it.
Work on that for awhile.