main.c 699 B

1234567891011121314151617181920212223242526272829303132333435
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #define _USE_MATH_DEFINES
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <math.h>
  7. #include <time.h>
  8. #include "header.h"
  9. int main() {
  10. int N = 0;
  11. double a = 0, b = M_PI/5;
  12. FILE* file;
  13. int counter = 0;
  14. char path[100];
  15. double S, length = 0;
  16. int n = 3;
  17. for (int power = 0;power <= 10;power++) {
  18. for (int richardson = 0;richardson <= 1;richardson++) {
  19. counter = 0;
  20. S = find_approx_integral(f, a, b, n, power, &counter, &length,richardson);
  21. sprintf(path, "res/%d_%d.txt", richardson, power);
  22. file = fopen(path, "w+");
  23. fprintf(file, "%.15lf %d %.16lf", S, counter, length);
  24. fclose(file);
  25. }
  26. }
  27. return 0;
  28. }