### Polynomial multiplication problem SOS

Hi guys,

My multiplication algorithm is not working correctly, it keeps giving me some non sense term. Any help would be appreciated.

Thanks,

Mike

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144`` `````` class Pol{ public: Pol(){size=0;pointer=new int[MAX];} Pol(const Pol& t){ size=t.size; pointer=new int[size]; for(int i=0;i=b)return a; else return b; } int get_shorter(const int a, const int b){ if(a<=b)return a; else return b; } Pol& operator=(Pol& t){ size=t.size; pointer=new int[size]; for(int i=0;i>(istream& in, Pol& t); friend ostream& operator<<(ostream& out, Pol& t); private: int *pointer; int size; }; int main(){ Pol test, test1; cout<<"Enter first polynomial\n"; cin>>test; cout<<"\nEnter second polynomial\n"; cin>>test1; cout<<"\n\n"<(ALPHA)<<"(X)= "<(BETA)<<"(X)= "<(THETA)<<"(X)= "<(OMEGA)<<"(X)= "<(GAMMA)<<"(X)= "<=0 && i!=0) out<<"+("<<*(t.pointer+i)<<"X"<<"^"<>(istream& in, Pol& t){ char input[MAX]; bool correct; int number; do{ cout<<"Enter "<>input; for(int i=0;i
I doubt anyone's going to debug your broken code for you. At least tell us where you suspect the problem is, or what you expected as output and what actually came out.
Everything works fine, the only issue is with the multiplication function.

examples go a long long way.

Can you please give us some example input and what output it's actually producing?

I tried to run the code and check myself, but it doesn't compile as-is (MAX, BETA, GAMMA, etc are undefined)
Apologies, I forgot to cut and paste the constants

 ``1234567`` ``````const int MAX=1000; const int ALPHA=224; const int BETA=225; const int THETA=233; const int OMEGA=234; const int GAMMA=226; ``````

For example, if I put in for the first pol
4
2
3
10

and for the second pol
3
5

I get

-12x^0+20X^1+10X^2+15X^3+50X^4-33686019X^5

Topic archived. No new replies allowed.