/* In this file, I have tried to reproduce the code on pages 83-84 as accurately as possible. In order to make it into a valid C-program, a number of changes were necessary. Perhaps the only subtle modification was the insertion of "(double)" into the formula for t below. */ #include #include #define PI 3.1415926 #define START_T 0.0 #define STOP_T (2*PI) #define LEFT -0.10 #define BOTTOM -1.10 #define RIGHT 6.50 #define TOP 1.10 #define STEP 400 #define WIDTH 6 main() { int i; double x, y, t; printf("w %f %f %f %f\n",LEFT,BOTTOM,RIGHT,TOP); printf("W %d\n",WIDTH); for (i=0; i<=STEP; i++) { t = START_T + ((double)i/STEP)*(STOP_T - START_T); x = t; y = sin(2*t); if (i == 0) printf("m %3.6f %3.6f\n",x,y); else printf("l %3.6f %3.6f\n",x,y); } }