Ok I have a program due on Monday. Just seeing if yall can help me out. I have tried different code but cant get the program to do everything its supposed to do.

Here's the assignment:

INTRODUCTION
Wind-tunnels are test chambers built to generate precise wind speeds. Accurate scale models of new aircraft can be mounted on a force-measuring supports in the test chamber, and measurements of the forces on the model can be made at different wind speeds and angles. Some wind tunnels can operate at hypersonic velocities, generating wind speeds of thousands of miles per hour. The sizes of the wind-tunnel test chamber vary from a few inches across to sizes large enough to accommodate a jet fighter. At the completion of a wind-tunnel test series, many sets of data have been collected that can be used to determine lift, drag, and other aerodynamic performance characteristics of a new aircraft at its various operating speeds and positions.

The collected data points can be used to estimate the performance of the aircraft at speeds and positions that are within the range of the experimental measurements but not equal to the original data. This is called interpolation. There are various ways of doing interpolation, the easiest of which is probably linear interpolation. For example, suppose we have data points (a, f(a)) and (c, f(c)). If we want to estimate the value of f(b), where a < b < c, we could assume that a straight line joined f(a) and f(c) and then use linear interpolation to estimate the value of f(b). The formula to do this is [f(a)-f(b)]/[b-a] = [f(a)-f(c)]/[c-a]. A nice illustrated explanation of linear interpolation can be found on pages 52 and 53 of your textbook.

SPECIFICATIONS
The input file tunnel.txt contains 17 wind-tunnel measurement pairs which consist of a flight-path angle (in degrees) and its corresponding coefficient of lift on each line in the file. The flight-path angles are in ascending order. Write a program that reads the wind-tunnel data into an appropriate array(s), prints a message showing the range of angles that are covered in the data file, and then allows the user to enter a flight-path angle. If the angle is within the bounds of the data set, the program should then use linear interpolation to compute the corresponding coefficient of lift and display it on the screen. If the user’s input is outside the range, the program should print an error message indicating so. The program should keep asking the user to enter flight-path values as long as the user desires. A sample program run using the input file tunnel.txt is shown below.

Your program should be contained in a single source code file called lastname_prog6.cpp (where lastname is your last name) and must follow the code format guidelines for this class (click here for these guidelines).


Here is the sample run:

SAMPLE RUN
The following shows a sample program run using the input file tunnel.txt (user input in bold).

Range of flight-path angles: -4 to 21 degrees

Please enter a flight-path angle in degrees: -3
Lift coefficient for -3 degrees: -0.119

Would you like to enter another value (Y/N)? y
Please enter a flight-path angle in degrees: -5
****Sorry, -5 is not within data range****

Would you like to enter another value (Y/N)? Y
Please enter a flight-path angle in degrees: 5.5
Lift coefficient for 5.5 degrees: 0.59575

Would you like to enter another value (Y/N)? N


Here is the data file "tunnel.txt":


-4 -0.182
-2 -0.056
0 0.097
2 0.238
4 0.421
6 0.479
8 0.654
10 0.792
12 0.924
14 1.035
15 1.076
16 1.103
17 1.120
18 1.121
19 1.121
20 1.099
21 1.059


And here is my code:
Code:
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

//Define constants and declare function prototypes
const int T=100;
double maxval(const double x[], int n);
double minval(const double x[], int n);

int main()
{
	// Declare objects
	int tpts(0);
	double y[T], flight_range, coef_lift;
	string filename;
	ifstream tunnel;

	// Prompt user for file name and open date file.
	cout << "Enter the name of the data file";
	cin >> filename;
	tunnel.open(filename.c_str());
	if (tunnel.fail())
	{
		cout << "Error opeing input file\n";
	}
	else
	{
		// Read a data value from the file
		tunnel >> flight_range >> coef_lift;

		// While there is room in the array and 
		// end of file was not encountered,
		// assign the value to the array and
		// input the next value.
		while (tpts <= T-1 && !tunnel.eof())
		{
			y[tpts] = flight_range;
			tpts++;
			tunnel >> flight_range;
		}

		// Find and print the maximum value
		cout << "Range of flight-path angles: " << minval(y,tpts) << " to " << maxval(y,tpts) << " degrees"<< endl;
			
		

		// Close file and exit program
		tunnel.close();
	}
return 0;
}

/* ------------------------------------------------------*/
/*   This function returns the maximum					 */
/*   value in the array x with n elements				 */

double maxval(const double x[], int n)
{
	// Declare local objects
	double max_x;

	// Determine maximum value in the array
	max_x = x[0];
	for (int k=1; k<=n-1; k++)
	{
		if (x[k] > max_x)
			max_x = x[k];
	}

	// Return maximum value
	return max_x;
}

/* ------------------------------------------------------*/
/*   This function returns the minimum					 */
/*   value in an array x with n elements				 */

double minval(const double x[], int n)
{
	// Declare objects
		double min_x;
	// Determine minimum value in the array
		min_x = x[0]; 
		for (int k=1; k<=n-1; k++)
		{
			if (x[k] < min_x)
				min_x = x[k];
		}

	// Return minimum value
		return min_x;
}
I found out how to do the range, but nothing else. I know this is long but I can really use the help.