fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <cmath>
  4.  
  5. void f(double a, double b, double c, double& h, double& s){
  6. double d;
  7. d=b*b-4*a*c;
  8. h=(-b+sqrt(d))/(2*a);
  9. s=(-b-sqrt(d))/(2*a);
  10. }
  11. int main() {
  12. double x,y,z,m,n;
  13. m=0;
  14. n=0;
  15. cin>>x>>y>>z;
  16. f(x,y,z,m,n);
  17. cout<<m<<endl<<n;
  18. return 0;
  19. }
Success #stdin #stdout 0s 5316KB
stdin
1 9 2
stdout
-0.227998
-8.772