Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Ru");
- double epsilon, alpha, x, frac = 1, ans = 1;
- cout << "Введите точность (эпсилон): ";
- cin >> epsilon;
- cout << "Введите степень: ";
- cin >> alpha;
- srand((LC_TIME, NULL));
- x = sin(rand());
- double n = 1;
- while (abs(frac) > epsilon)
- {
- frac = frac * ((alpha - n + 1)*x)/n;
- ans += frac;
- n++;
- }
- cout << " x = " << x << endl;
- cout << " (1+x)^a = " << endl;
- cout << "Значение суммы ряда: " << ans << endl;
- cout << "Значение встроенной функции: " << pow(1+x, alpha) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement