Given a set of data (two columns of data, flight path angles and lift coefficients) in a separate file, I need to write a program so the user can input a flight path angle and the program will return the appropriate lift coefficient given (if their angle matches one in the set) or interpolate the two closest values if their input is between two given angles. The compiler is telling me that i have error C2447: missing function header (old-style formal list?) up near the top, and fatal error C1004: unexpected end of file found near the bottom. Some help??
FPAngle= the angles given in the file. LiftCoef= coefficients given in the file, Angle= user input angle, LCoef=interpolated coefficient
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void interpolate(double FPAngle, double LiftCoef, double Angle, double LCoef);
{
{
LCoef = LiftCoef[i-1]+((Angle-FPAngle[i-1])*(LiftCoef[i]-LiftCoef[i-1])/(FPAngle[i]-FPAngle[i-1]));
return;
}
int main()
{
// declare;
ifstream CalcLift;
string filename;
double FPAngle[17];
double LiftCoef[17];
double Angle;
double LCoef;
int i;
// Get data file
cout << "Enter data filename: ";
cin >> filename;
CalcLift.open(filename.c_str());
if(CalcLift.fail())
{
cout << "Error opening input file\n";
}
else
{
for (i=0; i<17; i++);
{
CalcLift >> FPAngle[i] >> LiftCoef[i];
cin >> "Enter flight path angle: ";
cin >> Angle;
}
for(Angle == FPAngle[i])
{
cout << LiftCoef[i];
}
for (Angle=-4; Angle < FPAngle[i]; Angle++);
{
interpolate (FPAngle[i], FPAngle[i-1], LiftCoef[i], LiftCoef[i-1]);
cout << LCoef;
}
CalcLift.close();
return 0;
}