Mathematical Operations with digits in strings

Hey there, I'm working on a class project, and I'm having a difficulty. Suppose I have: string a = "21" and string b = "30"; normally, a+b=2130 (i.e concatenation of the characters in the string) but suppose I want a+b=51 (i.e. numerical addition) how do I go about this?
Thanks
Convert the strings to integers (in this case) and add the results.

1
2
3
4
5
6
{
	string a("21");
	string b("30");
	int sum = stoi(a) + stoi(b);
	cout << sum << endl;
}
Topic archived. No new replies allowed.