Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. #include <iostream>
  2. #include "Polynom.h"
  3. #include "rational.h"
  4. #include<iostream>
  5. using namespace std;
  6.  
  7.  
  8. void testPolynomial()
  9. {
  10.     cout << "----- start testPolynomial ---------" << endl;
  11.     cout << "test0 :" << Polynom::getMaxDegree() << endl;
  12.     Polynomial p1;
  13.     cout << "test1: " << p1;
  14.     Polinomial p2(6);
  15.     p2.setCoeff(2, 0.4);
  16.     cout << "test2: " << p2 << "degree=" << p2.getDegree(false) << endl;
  17.     double c[5] = { 0.1, 0.2, 0 ,11.5, 1.3 };
  18.     Polinomial p3(c, 4);
  19.     cout << "test3: " << p3;
  20.     p2.setCoeff(2, 0.0);
  21.     cout << "test4: " << p2;
  22.     cout << "test6 :maxDegree = " << Polinomial::getMaxDegree() << endl;
  23.     cout << "______________" << endl;
  24. }
  25. void testRational() {
  26.     cout << "----- start testRational ---------" << endl;
  27.     cout << "test7" << endl;
  28.     Rational r1;
  29.     r1.print();
  30.     cout << r1;
  31.     double c[] = { 0,2,2,3,4,5 };
  32.     Polinomial p1(c, 5);
  33.     c[0] = 1.2;
  34.     Polinomial p2(c, 3);
  35.     Rational r2(p1, p2);
  36.     cout << "test8" << endl;
  37.     r2.print();
  38.     cout << endl << r2 << endl;
  39.     cout << "test9" << endl;
  40.     cout << "nom = " << r2.getNom();
  41.     cout << "denom = " << r2.getDenom();
  42.  
  43.     cout << "test10 :maxDegree = " << Polinomial::getMaxDegree() << endl;
  44.     cout << "__________________________" << endl;
  45. }
  46.  
  47. int main()
  48. {
  49.     testPolynomial();
  50.     testRational();
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement