#include #include "polynomial.h" int main() { Polynomial A; Polynomial B = A; A.SetCoefficient(3, 1.23); A.SetCoefficient(0, -3.14159); cout << "A (degree " << A.Degree() << "): "; A.Print(); A.SetCoefficient(3, 0.0); cout << "A (degree " << A.Degree() << "): "; A.Print(); A.SetCoefficient(5, 5.67); cout << "A (degree " << A.Degree() << "): "; A.Print(); B = A; A.SetCoefficient(2, 99.9); B.SetCoefficient(1, -56.78); cout << "A (degree " << A.Degree() << "): "; A.Print(); cout << "B (degree " << B.Degree() << "): "; B.Print(); Polynomial C = A; C.SetCoefficient(12, 76.23); cout << "C (degree " << C.Degree() << "): "; C.Print(); C.SetCoefficient(12, 0.0); cout << "C (degree " << C.Degree() << "): "; C.Print(); C.SetCoefficient(2, -2.0); cout << "C (degree " << C.Degree() << "): "; C.Print(); C.SetCoefficient(5, 0.0); C.SetCoefficient(2, 0.0); C.SetCoefficient(0, 0.0); cout << "C (degree " << C.Degree() << "): "; C.Print(); C.SetCoefficient(9, -32.0); C.SetCoefficient(4, 12.3); C.SetCoefficient(1, -101.1); cout << "C (degree " << C.Degree() << "): "; C.Print(); cout << "B (degree " << B.Degree() << "): "; B.Print(); A = B + C; cout << "A (degree " << A.Degree() << "): "; A.Print(); A = A - A; cout << "A (degree " << A.Degree() << "): "; A.Print(); B = C = A; cout << "B (degree " << B.Degree() << "): "; B.Print(); cout << "C (degree " << C.Degree() << "): "; C.Print(); B.SetCoefficient(2, 3.0); B.SetCoefficient(0, 6.0); C.SetCoefficient(2, 1.0); C.SetCoefficient(0, -2.0); A = B * C; cout << "A (degree " << A.Degree() << "): "; A.Print(); B.SetCoefficient(1, -1.0); C.SetCoefficient(1, 3.0); C.SetCoefficient(0, -3.0); A = B * C; cout << "A (degree " << A.Degree() << "): "; A.Print(); A = B + C; cout << "A (degree " << A.Degree() << "): "; A.Print(); A = B - C; cout << "A (degree " << A.Degree() << "): "; A.Print(); return 0; }