#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
    double a = 0.1, b = 1.0;
    int N = 100;
    double h = (b - a) / 10;

    cout << fixed << setprecision(6);
    cout << setw(10) << "x" << setw(16) << "S(x)" << setw(16) << "Y(x)" << endl;

    for (int j = 0; j <= 10; j++) {
        double x = a + j * h;

        double Y = (1 - x * x / 2) * cos(x) - x / 2 * sin(x);

        double S = 1, t = 1;
        for (int n = 1; n <= N; n++) {
            t = -t * x * x / ((2 * n - 1) * 2 * n);
            S += (2 * n * n + 1) * t;
        }

        cout << setw(10) << x << setw(16) << S << setw(16) << Y << endl;
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: