How do you append an int to a string in C++?

int i = 4;
string text = "Player ";
cout << (text + i);

I’d like it to print Player 4.

The above is obviously wrong but it shows what I’m trying to do here. Is there an easy way to do this or do I have to start adding new includes?

Leave a Comment