Convert mathematical operations from string to integer?

If I have input string s = "5+3"; and I have to calculate this and return INT which is equal to 8. How can I do that?
Last edited on
Thats seems a little to complicated for this task. But how do I take each number from that string?
But how do I take each number from that string?
Either use stringstreams ( http://www.cplusplus.com/reference/sstream/istringstream/ ) and work with string like with normal stream (as std::cin), or extract substring containing number and apply stoi() function.
Topic archived. No new replies allowed.