home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c129 / 1.ddi / INTEGRDE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-04-12  |  825 b   |  42 lines

  1. # include <math.h>
  2. # include <stdio.h>
  3. # include "miscio.h"
  4. # include "integrat.h"
  5.  
  6. float yi[20];
  7. float xl1;
  8. float xh1;
  9. float ans1;
  10. int xxl1;
  11. int xxh1;
  12. int i1;
  13. int numseg;
  14. float sp;
  15. float i;
  16.  
  17.  
  18. void main()
  19. {
  20.  /*  ClrScr();
  21.  */  for ( i1 = 0; i1 <= 10; ++i1 ) {
  22.       i = i1 / 10.0;
  23.       yi[i1] = exp(i);
  24.    }
  25.    xl1 = 0.0;
  26.    xxl1 = 0.0;
  27.    xxh1 = 10.0;
  28.    xh1 = 1.0;
  29.    sp = 1.0 / 10.0;
  30.    IntegratVector(yi,sp,xxl1,xxh1,&ans1);
  31.    printf( "Integrate Vector\n");
  32.    printf("Area under the curve = %8.3f\n", ans1);
  33.    printf("\n");
  34.    printf("Integrate Function\n");
  35.    for ( i1 = 1; i1 <= 10; ++i1 ) {
  36.       numseg = 2 * i1;
  37.       IntegratFunction(numseg,xl1,xh1,&ans1);
  38.       printf("Number of segments = %d  Area under the curve = %8.10f\n",
  39.                 numseg,  ans1);
  40.    }
  41. }
  42.