Operator + with linked list ADT
<p>I have a project which you import a polynomial (Coefficient and exponent) into a linked list with s structure of Coefficient, Exponent, and a pointer to the next node. I have the storage all set but am having problems with the operators. I have got the = all set but going beyond that im having problems. </p>

<p>So far I have</p>

<pre><code>Poly Poly::operator+ (const Poly&amp; orig){
    bool firstTime = 0;
    Poly temp;
    temp.Head = new PolyTerm;
    temp.Size = 1;
    ptrType New = temp.Head;
    ptrType cur = Head;
    for(int i = 1; i &lt;= Size; i++) {
            ptrType org = orig.Head;
            for(int j = 1; i &lt;= orig.ListLength(); j++) {
                    if(org-&gt;exp == cur-&gt;exp) {
                            if(firstTime) {
                                    New-&gt;Next = new PolyTerm;
                                    New = New-&gt;Next;
                                    New-&gt;Next = NULL;
                                    temp.Size += 1;
                            }
                            New-&gt;coef = ((cur-&gt;coef) + (org-&gt;coef));
                            New-&gt;exp = cur-&gt;exp;
                            firstTime = 1;
                            break;
                    }
                    org = org-&gt;Next;

            }
            cur = cur-&gt;Next;
    }

    return temp;
}
</code></pre>

<p>it seems to run fine and with break points it gets to return and returns, but my program hangs after that. Im not sure what I have done wrong but i think it is simple</p>

<p>I hope I have provided enough info. Feel free to ask something</p>
