Please help how do i do this program?? i have only two more days before it is due :(


Write a program to read data from a large text file. Within the file, the data are arranged in two columns, separated by white space characters, and comprised of a variable number of rows of data, the last of which contains nine nines (999999999) in each column. An example data file is found on the Blackboard site. The rows of data are x and y pairs of data where x is an angle in degrees and y is a function of that angle. The angle data are spaced irregularly.
Input the data and compute a new set of x and y values at equal integer increments (0,1,2,…) of angle from 0 to 360 degrees. Compute the new y values using linear interpolation. Output new, equally spaced data to a file; include the name of the original data file within the new data file.

This is what i have so far:

#include<iostream.h>
#include<fstream.h>

int main(){
    ifstream fin("prog8.dat");
   float y[1000], x[1000]; //read the two columns
   for (int lcv = 0; lcv < 1000; lcv++)
   fin >> y[lcv]>> x[lcv];
   
   // y fucntion
   y[lcv] = y[lcv-1]+ ((y[lcv+1]-y[lcv-1])/(x[lcv+1]-x[lcv-1])*(x-x[lcv-1]))
WaltP commented: Jsut letting you know it's rude to use the word URGENT, and many will ignore your post... -3

After inputting the data, should you not create a separate for loop from 0.. 360 for that increment stuff ?

Be a part of the DaniWeb community

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