123456789101112131415161718192021222324252627282930 |
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <time.h>
- #include "header.h"
- double f(double x,int* c) {
- *c += 1;
- return pow(x, 5) - 2.9 * pow(x, 3) + 6.5 * pow(x, 2) - 7 * x;
- }
- int main() {
- double a = 0, b = 1.35,eps;
- int* cs;
- char path[100];
- FILE* file;
- for (int i = 0;i < 11;i++) {
- sprintf(path, "C:/Users/egorl/source/repos/gitbranch/num_methods_sem2/KR/KR/res/%i.txt",i);
- file = fopen(path,"w+");
- eps = pow(10, -i);
- cs = counters(f, a, b, eps);
- fprintf(file, "%d %d", cs[0], cs[1]);
- fclose(file);
- }
- return 0;
- }
|