main_rational.cpp 400 B

123456789101112131415161718192021
  1. #include <iostream>
  2. #include "Rational.h"
  3. using namespace std;
  4. int main() {
  5. Rational a, b, c, D, x1, x2;
  6. a = Rational(1.0 / 1);
  7. b = Rational(-62.0 / 133);
  8. c = Rational(-51.0 / 133);
  9. cout << "sqrt" << endl;
  10. D = ((b*b) -(Rational)4 * a * c).sqrt();
  11. x1 = ((-b - D) / ((Rational)2 * a));
  12. x2 = ((-b + D) / ((Rational)2 * a));
  13. cout << (double)x1 << endl;
  14. cout << (double)x2 << endl;
  15. }