Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- float max(float x, float y, float z);
- float min(float x, float y, float z);
- float SystemOfTheEquations(float a1, float b1, float c1, float a2, float b2, float c2);
- float condition(float a, float b);
- int main()
- {
- setlocale(LC_ALL, "Russian");
- float x, y, z, a, b, a1, a2, b1, b2, c1, c2;
- cout << "X: ";
- cin >> x;
- cout << "Y: ";
- cin >> y;
- cout << "Z: ";
- cin >> z;
- cout << "Мин: " << min(x, y, z) << endl;
- cout << "Макс: " << max(x, y, z) << endl << endl;
- cout << "Параметры первого уравнения: ";
- cin >> a1 >> b1 >> c1;
- cout << "Параметры второго уравнения: ";
- cin >> a2 >> b2 >> c2;
- SystemOfTheEquations(a1, b1, c1, a2, b2, c2);
- cout << endl;
- cout << "A: ";
- cin >> a;
- cout << "B: ";
- cin >> b;
- x = condition(a, b);
- if (x == 0) cout << "Данные не из того промежутка. Решений нет." << endl;
- else cout << "X: " << x << endl;
- }
- float condition(float a, float b)
- {
- float x;
- if ((1 <= fabs(a) && (fabs(a) <= 4)))
- {
- if (a > b) x = a + 2 / b + 4;
- else if (a <= b) x = a + b;
- return x;
- }
- else
- {
- return x = 0;
- }
- }
- float max(float x, float y, float z)
- {
- float max = x;
- if (y > max) max = y;
- if (z > max) max = z;
- return max;
- }
- float min(float x, float y, float z)
- {
- float min = x;
- if (y < min) min = y;
- if (z < min) min = z;
- return min;
- }
- float SystemOfTheEquations(float a1, float b1, float c1, float a2, float b2, float c2)
- {
- if (fabs(a1 * b2 - a2 * b1) >= 0.0001)
- {
- cout << "x = " << (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1) << '\n';
- cout << "y = " << (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1) << '\n';
- }
- else
- {
- cout << "Условие не выполнено. Решений нет." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement