Sum calculation (string)

They ask me a function that has to make this, example:
//Input: (+ 10 5)
//Output: 15

//Input: (+ (+ 2 3) (+ 3 1))
//Output: 9

I have think of two functions, one for the recursive of the string:

string recursive(string phrase)

And another one for the sum, that only sums two numbers.

Those anyone know how to start with the recursive function, on how to detect the parenthesis and the order to call the recursive function to return the right value.

Thanks a lot.
You might want to have a look at this: http://www.cplusplus.com/forum/beginner/202782/#msg964731
Topic archived. No new replies allowed.