Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- double epsilon;
- cout << "vvedite Epsilon: " << endl;
- cin >> epsilon;
- unsigned long i1 = 0;
- unsigned long i2 = 0;
- double v1 = 4., v2 = 3.;
- unsigned long ii1 = 0, ii2 = 0;
- while (true)
- {
- double current = v1 + 4 * (i1 % 2 == 0 ? -1 : 1) * (1. / (3 + 2 * i1));
- i1++;
- if (ii1 < 10) {
- cout << "value 1 " << current << endl;
- ii1++;
- }
- if (fabs(current - v1) < epsilon) {
- v1 = current;
- break;
- }
- v1 = current;
- }
- while (true)
- {
- double current = v2 + 4 * (i2 % 2 == 0 ? 1 : -1) * (1. / (
- (i2 + 2)*(i2 + 3)*(i2 + 4)
- ));
- i2++;
- if (ii2 < 10) {
- cout << "value 2 " << current << endl;
- ii2++;
- }
- if (fabs(current - v2) < epsilon) {
- v2 = current;
- break;
- }
- v2 = current;
- }
- cout << "cicl 1 : " << i1 << endl;
- cout << "cicl 2: " << i2 << endl << endl;
- cout << "ZNACHENIYA" << endl;
- cout << "1: " << v1 << endl;
- cout << "2: " << v2 << endl << endl;
- if (i1 > i2)
- {
- cout << "Cicl 2 bistree" << endl << endl;
- }
- else
- {
- cout << "cicl 1 bistree" << endl << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement