Thanks for the tips guys, I wrote some new codes just now and got the program to compile. But there seems to be something wrong with the koolplot function I wrote.
The following error popped up, Any ideas what's going on?
graph.c:24 error: cannot convert 'double' to 'double' for argument '1' 'void graph(double*, int)'
Here's the source code
Code:
#include <stdio.h>
#include <koolplot.h>
#define A 100
void graph(double num[], int z);
int main()
{
int col, z=0, n=0;
double col2[A], half[A];
FILE *data;
data = fopen("textfile.txt", "r");
while (fscanf(data, "%lf %lf", &col, &col2[z]) == 2)
{
half[n] = col2[z]/2;
printf("\n%d %lf\n", col, half[n]);
graph(half[n], col);
z++;
n++;
}
fclose(data);
return 0;
}
/* Is there something wrong with the function? */
void graph(double num[], int z)
{
Plotdata x(0, 20);
Plotdata y(num, z);
plot(x,y);
}
the text file I'm using:
Code:
0.5 301.232
1.5 311.311
2.5 321.123
3.5 282.776
4.5 569.650
5.5 554.225
6.5 196.213
7.5 1221.128
8.5 770.550
9.5 922.232