adding a string to another string

How would you take the letter/numbers from one string and add it to another, then continue adding and building on the second string?

1
2
3
4
5
string s1, s2, sentence;
s1 = "He";
s2 = "llo";
sentence = s1+ s2;
cout << sentence;
I guess I didn't explain well enough…
I have a string that gets a value every time a loop runs through. It runs through varying times depending on the number you put in. I want to get the value of of the string from each run and add them all together in another string.

ex.
1st loop run through : num = 1
2nd loop run through : num = 2
3rd loop run through : num = 3

answer = num + num + num
answer = 123

My problem is the code is adding it like this:
answer = 112123
can i see the relevant code please
Last edited on
Topic archived. No new replies allowed.