Plotting data points

I need some help writing code for c++ to make a plot. I think im suppose to use an array but im lost after that. The plots are suppose to look like the pictures in the link and the points come from a data file that im reading in. The min and max values are in two other functions which i have completed but im stuck on how to plot the points.

http://www.cs.uic.edu/~i109/samplePlots.txt

So far all i have is:

void plot (double data[], int nPoints, int nRows){

int plot1[nRows][nPoints];

for(int i = 0; i < nRows; i++){
for(int j = 0; j < nPoints; j++){
cout << " " << endl;
}
}

}


This is also part of the actual assignment, the part im on.

The numbers on the left edge are the maximum and minimum values in the
array, as returned by the maxArray and minArray functions respectively.

The lines on the left edge and bottom are simply printed characters.
Generate the main body of the chart using the following steps:

1. Create a two-dimensional array of characters that is nPoints wide by
nRows high, e.g. "field[ nRows ][ nPoints ]".

2. Use a doubly-nested loop to fill the array with space characters.

3. Use a single loop to put one X character in each column of the array:

The row coordinate is given by:
( data[i] - min ) / ( max - min ) * nRows
where min and max are the minimum and maximum data
values in the array, and i refers to the i
the column of the array


If anyone could just point me in the right direction, even that would help!



Any help would be greatly appreciated.
Thanks!
Last edited on
Topic archived. No new replies allowed.