Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // x^2 - 6*x + 7 = 0
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "rus");
- float x, D, a, b, c, x1, x2;
- cout << "Введите первое число" << endl;
- cin >> a;
- cout << "Введите второе число" << endl;
- cin >> b;
- cout << "Введите третье число" << endl;
- cin >> c;
- D = b * b - 4 * a*c;
- cout << "D = " << D << endl;
- if (D > 0);
- {
- cout << "Ищем x1" << endl;
- std::cout << "sqrt(" << D << ") = "
- << sqrt(D)
- << std::endl;
- x1 = (-b + sqrt(D)) / 2 * a;
- cout << "x1 =" << x1 << endl;
- x2 = (-b - sqrt(D)) / 2 * a;
- cout << "x2 =" << x2 << endl;
- }
- /*
- else {
- cout << "Нет решения" << endl;
- }
- */
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement