C++ string parsing
<p>All:</p>

<p>I got one question in string parsing:</p>

<p>For now, if I have a string like "+12+400-500+2:+13-50-510+20-66+20:"</p>

<p>How can I do like calculate total sum of each segment(  : can be consider as end of one segment). For now, what I can figure out is only use for to loop through and check +/- sign, but I do not think it is good for a Universal method to solve this kind of problem :( </p>

<pre><code>For example, the first segment, +12+400-500+2 = -86, and the second segment is
+13-50-510+20-66+20 = -573

1) The number of operand is varied( but they are always integer) 
2) The number of segment is varied
3) I need do it in C++ or C.
</code></pre>

<p>I do not really think it as a very simple question to most newbie, and also I will claim this is not a homework. :)</p>

<p>best,</p>
