// 10192009.cpp, P H Anderson, Oct 25, '09

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

FILE *f;

int main()
{
   float x1, x2, y1, y2, m; 
   f = fopen("c:\\x.txt", "wt"); // should check for error
   
   for(int n=0; n<=25; n++)
   {
        x1 = 0.03 + M_PI / 2.0 * n / 25;
        x2 = 0.03 + M_PI / 2.0 * (n+1) / 25;
        y1 = sin(3*x1) / (x1 + 1.0e-12); // avoid div my zero
        y2 = sin(3*x2) / (x2 + 1.0e-12);
        m = (y2 - y1) / (x2 - x1);
        
        printf("%.2f %.2f %.2f\n", (x1 + x2) / 2, y1+y2/2, m);
        fprintf(f, "%.2f %.2f %.2f\n", (x1 + x2)/2, y1 + y2/2, m);
   }
   fclose(f);
   system("type c:\\x.txt");         
   system("pause");        
}