Linijkę którą pogrubiłam z komentarzem kompilator wyświetla jako błąd.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
double x, y = 0, el, k = 1, blad;
int main(int argc, char* argv[])
{
FILE* fp;
char* commandsForGnuplot[] = { "set title \"TITLEEEEE\"", "plot 'data.temp'" };
FILE* gnuplotPipe = popen("gnuplot -persistent", "w");
fprintf(gnuplotPipe, "plot '-' \n");
if ((fp = fopen("test.txt", "w")) != NULL)
{
printf("Obliczanie szeregu dla funcji y=x+2/k*(k+2) przedzialu od 0.5 do 0.7\n");
for (x = 0.5; x < 0.72; x += 0.002) // to ta linijka
{
y = 0.;
do
{
el = (x + 2) / k * (k + 2);
y += el;
k++;
} while (fabs(el) > 0.00001);
printf("x=%f y=%f\n", x, y);
fprintf(fp, "%f %f\n", x, y);
fprintf(gnuplotPipe, "%lf %lf\n", x, y);
k = 1;
}
}
fclose(fp);
fprintf(gnuplotPipe, "e");
return 0;
}