fork download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. double a = 1, b = 10000, c = 1;
  9. double delta, x1, x2;
  10.  
  11. delta = b * b - 4 * a * c;
  12.  
  13. // pierwiastek "duzy"
  14. x1 = (-b - sqrt(delta)) / (2 * a);
  15.  
  16. // drugi z Viète'a
  17. x2 = c / (a * x1);
  18.  
  19. cout << "x1 = " << x1 << endl;
  20. cout << "x2 = " << x2 << endl;
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
x1 = -10000
x2 = -0.0001