Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cmath>
- #include <windows.h>
- using namespace std;
- int main ()
- {
- SetConsoleOutputCP(CP_UTF8);
- srand(time(NULL));
- double x = ((double)rand()) / ((double)RAND_MAX) * (-2) + 1;
- double e = 0, sum = 0;
- double a;
- int n = 1;
- cout << "Значение X: " << x << endl;
- cout << "Введите эпсилон: " << endl;
- cin >> e;
- cout << "Введите альфа: " << endl;
- cin >> a;
- double a0 = 1, a1 = a*x;
- sum += a0;
- while (fabs(a1) >= e / 10)
- {
- sum += a1;
- a0 = a1;
- /* for (int i = 1; i <= n+1; i++) {
- res = res * i;
- } */
- a1 = a1*(a-n)*x/(n+1);
- n++;
- }
- cout <<"Значение функции: "<< pow((1+x),a) << endl;
- cout << "Значение суммы ряда: "<< sum << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement