Write a program that reads a set of measurements from a file called sensorDataRaw.txt. There are two columns of data in the file; the first is time in minutes and the second is height in feet. The program should read all of the data into two arrays, and then sort the data based on the time values while maintaining the ordered pairs - the heights should be rearranged in the same way so that the (time,height) relationship is preserved. After sorting the data, the program should print the two sorted arrays to a single output file.
Sorting should occur in a function that has this prototype:
void sortTwoArraysBasedonFirst(double x[], double y[], int numPoints);
Declare both arrays with space for 100 values, which is more than the number of rows in the file.

Extra Credit Same as option (1) except the file operations should also take place in functions. Declare the input and output files in the main function, but read from or write two the input and output files using functions that have the following prototypes:
void readTwoArrays(double x[], double y[], int& numPoints, ifstream& fin);
void displayTwoArrays(double x[], double y[], int numPoints, ostream& fout);

Note that the last argument in each function is the name of your ifstream or ofstream object or cout. Call the output function three times from main. The first time will be to display the unordered list to the screen. The second and third times will display the arrays to the screen and print them to the output file.

If anyone know ho to do this problem can you help???? Thanks

time height

0.779 4.178
1.020 5.259
0.704 4.657
0.716 4.593
1.129 5.409
0.643 3.982
0.885 4.424
0.691 4.308
1.351 5.473
0.824 5.012
1.226 5.447
1.096 4.908
1.390 5.832
0.402 3.686
0.567 4.284
1.280 5.215
0.457 4.168
0.504 3.763
0.924 4.954
1.076 5.147
0.851 4.769
-99 -99

Show us what you have written so far and we can help you through it if you have any actual questions.

Do not just post up a homework assignment and expect someone to do it for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.