how to get the negative factors of a positive product with a sum
<p>I may not have explained this very well in the title simply because I don't really know how to explain it in the length a title has so I apologize for that. Anyways this is my current code:</p>

<pre><code>// Gets the product that is used to get the factors
cout &lt;&lt; "Enter a number that you want to be factored" &lt;&lt; endl;
cin &gt;&gt; y;

system("cls");

// Gets the sum from the user that the two factors need to add up to
cout &lt;&lt; "Input the sum that is needed" &lt;&lt; endl;
cin &gt;&gt; neededSum;

secondary = y;
system("cls");

// Lists the factors that add up to the specified sum
cout &lt;&lt; "The numbers that add up to " &lt;&lt; neededSum &lt;&lt; " are:" &lt;&lt; endl;
for (int i = 0; i &lt; 100; i++)
{
    x++;
    increment++;
    y = secondary / x;
    product = x * y;
    if (product == secondary)
    {
        sum = x + y;
        if (sum == neededSum)
        {
            cout &lt;&lt; x &lt;&lt; " and " &lt;&lt; y &lt;&lt; endl;
        }
    }
}
</code></pre>

<p>Basically it takes a product lists all the factors of that product. Then, it adds all of the factors together until it finds the one that adds up to the specified sum.</p>

<p>However, if the specified sum is negative like '-11' for instance it won't work because the factors of '28' (an example) are 4 and 7 not -4 and -7. I need to figure out a way to fix this so it knows when it has to be -4 and -7 instead of the positive reverse.</p>

<p>Thanks in advance for the help.</p>
