How to use Array to read curve points?

I need to write a program that reads in a list of engine thrust curve points and will compute the thrust for any given time.

How do I use an array to read in a max of 50 curve points??

Any Examples??



What is a "curve point" and how is thrust computed?
We got a curve, the curve represents the thrust of a engine. I have to divide the curve into 10 points(segments). So the program ask for the segments, then ask for a time for which thrust will be calculated. The thrust is calculated by
((time_entered - firstpoint) /(second point - first point)) *(thrust of second point - thrust of first point) + thrust of first point. I will create a function that calculated the thrust for wanted time.

Example output:
0.19 14.5
0.24 6.0
0.40 4.4
1.80 4.2

Enter a time: 1.0
The thrust at time 1.0 is 4.3

I'm confuse on how to read the segments into an array and how to call them to calculate the thrust.
You have a two-column table (time, thrust).

When you are given a time t (e.g. 1.0), you look up from the table the lower and upper bound (0.4 and 1.8) and retrieve the corresponding thrust values (4.4 and 4.2) too.

Then you linearly interpolate the thrust at t. You have equation for that.

There is http://www.cplusplus.com/reference/algorithm/equal_range/

An vector/array of pairs and a custom comp functor that compares only the time-values of those pairs.
Topic archived. No new replies allowed.