Hi please help. Any help would be appreciated :D

I have to write a program to read data from a large text file, analyze it, and output the results of the analysis to a data file. there are two data files to process.

Problem: Using airborne sensors that record GPS position and time, you have collected data on the airflow patterns of a tornado. The time (t) and altitude (Z) data are space-separated in a text file (twister.dat).

-As a first-step in data analysis, read-in the (unknown number of) data points and compute when the sensor changes direction. This occurs when the velocity, ΔZ/Δt, changes sign, passing through zero.

-Output the time and altitude of each occurrence of a change in direction to a new data file, change.dat.

So far this is what i have and i am stuck because i do not know how to find when the derivative goes from negative to positive or from positive to negative.

```
#include<iostream.h>
#include<fstream.h>
#include<string>
#include <C:\dislin\dislin.h>
main () {
ifstream fin ("prog10.text");
float x[10000], y[10000], deltaT[10000], deltaZ[10000], derivative[10000];
int nPoints;
int lcv = 0;
cout<< "The velocity changes direction at: " << endl;
for (lcv = 0; !fin.eof(); lcv++)
{
fin >> deltaT[lcv] >> deltaZ[lcv];
}
deltaT[lcv] = deltaT[lcv] - deltaT[lcv -1]; // finds how much T changes for each lcv
deltaZ[lcv] = deltaZ[lcv] - deltaZ[lcv-1]; // finds how much Z chnages for each lcv
derivative[lcv] = deltaT[lcv]/ deltaZ[lcv]; // equation for derivative
if(derivative[lcv]>0 && derivative[lcv-1] <0)
{
// find when the derivative goes from negative to positive or from positive to negative
}
```

*Edited 5 Years Ago by hawita*: n/a