Hi, I have a problem, and I can't find the answer.
How do you add a string and an int, and push it into a vector.
thanksCode:int i = 5;
vector<string> vs;
vs.push_back(string("hello") + i);
Printable View
Hi, I have a problem, and I can't find the answer.
How do you add a string and an int, and push it into a vector.
thanksCode:int i = 5;
vector<string> vs;
vs.push_back(string("hello") + i);
the integer itself has to be converted into a character array (string) and then you can add two together....
look up the: itoa() function.........
Use stringstreams