CARVIEW |
Select Language
HTTP/2 200
date: Mon, 13 Oct 2025 00:00:43 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=d50680d3efdc8717c62af906d20418d2f60aeebf427c910ec44bcedc313633a4a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22jbPRl11wQWYZVTesIV8f5WiriLcIzNKe%22%3B%7D; HttpOnly; Path=/
cf-ray: 98da8eea9e9b7679-BLR
Laba3_1 - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- const double EPS = 1E-6;
- int main() {
- setlocale(LC_ALL, "Russian");
- double a, b, x, fa, fb, fx;
- bool isCorrect;
- cout << "Программа уточняет корень уравнения методом половинного деления" << endl;
- do {
- isCorrect = false;
- cout << "Введите значение a : ";
- cin >> a;
- if (cin.fail() or (a < 0)) {
- isCorrect = true;
- cout << "Ошибка" << endl;
- cin.clear();
- while (cin.get() != '\n');
- }
- } while (isCorrect);
- do {
- isCorrect = false;
- cout << "Введите значение b : ";
- cin >> b;
- if (cin.fail() or (b < a)) {
- isCorrect = true;
- cout << "Ошибка" << endl;
- cin.clear();
- while (cin.get() != '\n');
- }
- } while (isCorrect);
- fa = exp(a) - 10 * a;
- fb = exp(b) - 10 * b;
- if (fa * fb > 0) {
- cout << "На отрезке [A, B] нет корня или их четное количество." << endl;
- return 1;
- }
- do {
- x = (a + b) / 2;
- fx = exp(x) - 10 * x;
- if (fa * fx < 0) {
- b = x;
- fb = fx;
- }
- else {
- a = x;
- fa = fx;
- }
- } while (fabs(b - a) > EPS && fabs(fx) > EPS);
- cout << "Корень уравнения: " << x << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
🚀 Swapzone +37% glitch
JavaScript | 2 sec ago | 0.24 KB
-
⭐⭐⭐Crypto Accounts⭐⭐
Java | 3 sec ago | 0.15 KB
-
✅ Make $2500 in 20 minutes⭐ F
JavaScript | 9 sec ago | 0.25 KB
-
🚨 Free Crypto Method 🚨
JavaScript | 12 sec ago | 0.24 KB
-
⭐⭐⭐MAKE $500 IN 15 MIN⭐⭐
Java | 16 sec ago | 0.15 KB
-
📌 Swapzone +37% glitch ⭐ J
JavaScript | 18 sec ago | 0.25 KB
-
⭐⭐⭐Profit Method⭐⭐
Java | 19 sec ago | 0.15 KB
-
💡 EASY MONEY GUIDE ✅ Working
JavaScript | 21 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand