Can't seem to get right array info

Description of how program output should look and work as follows...

Enter the curve data(0 for thrust to end list):
0.19 14.5
0.24 6.0
0.40 4.4
1.80 4.2
1.86 0.0

Enter a time: 1.0
The thrust at time 1.0 is 4.3 newtons.
Would you like another thrust value? (Y or N): Y

Enter a time: 1.9
The thrust at time 1.0 is 4.3 newtons.
Would you like another thrust value? (Y or N): N

End program.

------------------------------------------------------------
How my code looks so far...

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cstdlib>
using namespace std;

//
//
//
const int MaxValues = 50;

//
//
//
double enterThrustData( double thrustCurve[MaxValues][2]);

//
//
//
double getThrustData(double thrustTime, const double thrustCurve[][2]);

int main()
{
char ans;
double thrustCurve[MaxValues][2];
double time = 0;

enterThrustData(thrustCurve);

do
{
cout << "\nEnter a time: ";
cin >> time;
cout << "The thrust at time is " << time << fixed << setprecision(1)
<< getThrustData(time, thrustCurve) << " Newtons.\n";
cout << "Would you like another thrust value? (Y or N): ";
cin >> ans;
}
while (ans=='y' || ans=='Y');
cout << "\n\nEnd Program.\n";
return 0;
}


//
//
//
double enterThrustData(double thrustCurve[MaxValues][2])
{
string junk;
double dataTime =0;
double dataThrust =0;
int i = 1;
int j = 0;

cout << "Enter thrust curve data (0 for thrust to end list): " <<endl;
do
{
dataTime =i;
dataThrust =j;
getline (cin,junk);
{
cin >> dataTime >> dataThrust;
thrustCurve[i][0] = dataTime;
thrustCurve[1][j] = dataThrust;
}
}
while(dataThrust !=0);
i++;

return thrustCurve[i][j];
}

//
//
//
double calcthrust(double time, const double thrustCurve[MaxValues][2])
{
double Newtons;
int i=0;
int j=0;

if (time <= 0)
{
Newtons = 0;
}
else if (time <= thrustCurve[0][0])
{
Newtons = ((time)/(thrustCurve[0][0]))*(thrustCurve[0][1]);
}
else if (time > thrustCurve[0][0])
{
i = 0;
j = 1;
}
while(time >= thrustCurve[i][0])
{
if (time >= thrustCurve[i][0] && time < thrustCurve[j][0])
{
Newtons = ((time - thrustCurve[i][0])/(thrustCurve[j][0] - thrustCurve[i][0])) *
(thrustCurve[j][1] - thrustCurve[i][1]) + (thrustCurve[i][1]);
}
else
{
Newtons = 0;
}
i++;
j++;
}
return Newtons;
}

-----------------------------------------------
any help to make this work right would be appreciated

}
Topic archived. No new replies allowed.