Solved
Multiplying Polynomials using recursion
Posted on 2002-05-02
I am using the GNU Compiler.
I am trying to multiply 2 polynomials.
Using recursion and arrays. Polynom.cpp has already been completed by the instructor. We just need to finish main.cpp, specifically (void MultPoly (Polynomial p, Polynomial q, Polynomial& r).)
The following the block is what is giving me issues:
void MultPoly (Polynomial p, Polynomial q, Polynomial& r)
{
int deg;
float coEff;
deg=p.GetDegree();
coEff=p.GetCoefficient(deg);
p.DeleteTerm(deg);
MultPoly(p,q,r);
coEff=coEff*r.GetCoefficient(deg);
r.InsertTerm(coEff,deg);
}
The whole program compiles correctly, but I am not getting any result for multiplying polynomials when I input 2 of them. It doesn't seg fault, it just doesn't print anything.
All it needs to do is multiply 2 polynomials together, then print the result to the screen.
Thanks for the help!