Your changes look fine for ordering the list in descending order. I might have left the list is ascending order and printed in reverse order, but either way works.
operators
---------
You're mixing idioms using a counter based for loop and iterators. As a consequence, you never advance your iterators. it and itR continue to point to the first element of the list.
I would use iterator based for loops.
1 2 3 4
|
for (it=m_Polynomial.begin(); it!=m_Polynomial.end(); it++)
{
for (itR=right.m_Polynomial.begin(); itR!=right.m_Polynomial.end(); it++)
{
|
line 81,114,151: if the degrees don't match, you add the right hand side term. This is going to result in adding every right hand side term every time through the outer loop (except when the degrees match). not what you want to do.
Print()
-------
Line 218: Same comment about mixing idioms with counter based for loop. You never advance your iterator.
Line 220: You're assigning the node the iterator points to to the term that was passed, wiping out the term that was passed. Remove this line.
Would you mind posting p3.txt and p4.txt?
Do you know the expected output for p3.txt and p4.txt?