Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cout << "Задание 4.6\n";
- eps = 0.1;
- s = 0;
- n = 0;
- cout << "Введите X1\n";
- x1 = TakeNum(-10, 10);
- cout << "Введите X2\n";
- x2 = TakeNum(-10, 10);
- cout << "Введите dx\n";
- dx = TakeNum(1, 10);
- cout << (" x | f(x) | count\n");
- for (double i = x1; i <= x2; i += dx) {
- count = 0;
- temp = i;
- fac = 1;
- n = 0;
- s = 0;
- while (fabs(temp) > eps) {
- for (int j = 1; j < 2 * n; j++)
- fac *= j;
- temp = (pow((-1), n) * (pow(i, 2 * n))) / fac;
- s += temp;
- n++;
- count++;
- }
- cout << fixed << setprecision(3) << i << " | " << fixed << setprecision(3) << s << " | " << count << endl;
- }
- cout << "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement