# include # include # include using namespace std; int main ( ) // // SINE_TABLE prints a table of 501 equally spaced points X // between 0 and 20 ( = 500 * 0.04 ), and the corresponding // values of the sine function. // // If the output of this program is redirected to a file, // it can be plotted. GNUPLOT is one program that can // plot the data. // { int i; float x; float y; x = 0.0; for ( i = 0; i <= 500; i++ ) { y = sin ( x ); cout << x << " " << y << "\n"; x = x + 0.04; } cerr << "Program wrote 501 points to file.\n"; return 0; }