-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardnewfile.cpp
More file actions
84 lines (80 loc) · 2.06 KB
/
Copy pathhardnewfile.cpp
File metadata and controls
84 lines (80 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
#include <cmath>
#include <clocale>
using namespace std;
//int main()
//{
// setlocale(LC_ALL, "Rus");
// int n, k = 1, f, y;
// float s = 0.0, eps, p = 1.0, a, b, t;
// cout << "Знаменатель" << endl;
// cin >> y;
// cout << "Точность" << endl;
// cin >> eps;
// t = y * y * y;
// b = 2 / (y * y * y);
// do
// {
// a = b;
// p *= k;
// k++;
// t *= y;
// b = (p + 1) / t;
// s += (p + 1) / t;
// }
// while (abs(a - b) > eps);
// cout << s;
//}
//int main()
//{
// setlocale(LC_ALL, "Rus");
// int n, k = 1, f, y;
// float s = 0.0, eps, p = 1.0, a, b, t;
// cout << "Введите знаменатель" << endl;
// cin >> y; //знаменатель
// cout << "Укажите точночть" << endl;
// cin >> eps; //точночть
// t = y * y * y;
// b = 2 / (y * y * y);
// do
// {
// a = b;
// p *= k; k++; //факториал k -> типо (k!+1)
// t *= y; //имеется ввиду y^(k+3) -> тоже самое, что (y^k)*(y^3) | это строка обозначает y^4, в 4 степени т.к k=1 и стпень = 1+3
// b = (p + 1) / t; //это что получается после сигмы -> тоесть p=k! , а t=y^4
// s += (k + 1) / t; //это что получается в итоге | s=сигма если правильно понимаю, то тут k=1 и числитель у нас без факториала
// }
// while (abs(a - b) < eps);
// cout << s;
//}
int main()
{
setlocale(LC_ALL, "Rus");
int n = 1, f, y, x;
float s = 0.0, eps, p = 1.0, a, b, t;
double sinus;
cout << "Введите числитель x" << endl;
cin >> x;
cout << "Введите точность" << endl;
cin >> eps;
f = (2 * n + 1);
sinus = sin(x);
t = x * x * x;
b = (x * x * x) / 6;
do
{
a = b;
p *= f; ++n;
b = t / p;
s += t / (2*n + 1);
}
while (abs(a - b) < eps);
if (sinus == s)
{
cout << "Ответ"<< s << endl;
}
else
{
cout << "Не существует" << endl;
}
}