#include "stdafx.h"
#include <math.h>
int _tmain()
{
double x;
double y;
char buf[256];
int i;
double start_x;
double step_x;
FILE* fp;
printf( "start_x =" );
fgets( buf, 256, stdin );
sscanf_s( buf, "%lf\n", &start_x );
printf( "step_x =" );
fgets( buf, 256, stdin );
sscanf_s( buf, "%lf\n", &step_x );
fp = fopen( "z:\\data.csv", "w" );
for( i = 0; i < 20; i++ ) {
x = start_x + ( i * step_x );
y = sin( x );
printf( "x= %f, y= %f\n", x, y );
fprintf( fp, "x=, %f, y=, %f\n", x, y );
}
fprintf( stderr, "file z:\\data.csv created\n" );
fclose( fp );
return 0;
}
x, y, buf, i, start_x,
step_x, fp
48