C++ Trouble doing simple addition in while() loop
<p>Hopefully someone can tell me what I'm doing wrong. I'm reading up to a specific point on each line within a text file and then trying to add that value to the value on the next line and continue doing so until the end of the file/loop. But at the moment, it will only add the values from the first two lines and not...</p>

<p>123 + 456 + 789 = totalPayroll.</p>

<p>My code is as follows:</p>

<pre><code>inStream.open("staffMembers.txt");

while(getline(inStream.ignore(256, '$'), line))
{
    totalPayroll = stoi(line) + stoi(line);
}

inStream.close();

cout &lt;&lt; "$" &lt;&lt; totalPayroll &lt;&lt; endl;
</code></pre>

<p>My text file is formatted as follows:</p>

<pre><code>1 | Person One | $123
2 | Person Two | $456
3 | Person Three | $789
</code></pre>
