How to concatenate a std::string and an int

I thought this would be really simple, but it’s presenting some difficulties. If I have

std::string name = "John";
int age = 21;

How do I combine them to get a single string "John21"?

Leave a Comment