Начертите блок-схему пожалуйста прошу С++

#include
#include
using namespace std;

double factorial(int n) {
double result = 1;
for (int i = 1; i <= n; i++) {
result *= i;
}
return result;
}

double S(double x, int n) {
double t = 0;
for (int k = 1; k <= n; k++) {
t += pow(-1, k) * pow(2 * x, 2 * k) / factorial(2 * k);
}
return t;
}

double Y(double x) {
return 2 * (pow(cos(x), 2) - 1);
}

int main() {
setlocale(LC_ALL, "rus");
int n;
cout << "Введите n: ";
cin >> n;

cout << "|\tx\t|\tY(x)\t|\tS(x)\t|\tY(x)-S(x)\t|\n" << endl;
cout << "--------------------------------------------------" << endl;
for (double x = 0; x <= 1; x += 0.1) {
double resultS = S(x, n);
double resultY = Y(x);
double r= abs(resultY - resultS);
cout << "|\t" << x << "\t|\t" << resultY << "\t|\t" << resultS << "\t|\t" << r << "\t|\n" << endl;
}

return 0;
}
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.