c++ string concatenation int code example
Example 1: concatenation cpp int and stirng
string result = name + std::to_string(age);
Example 2: int and string concatination cp[
std::string name = "John";
int age = 21;
std::string result;
result = name + boost::lexical_cast<std::string>(age);
result = name + std::to_string(age);
fastformat::fmt(result, "{0}{1}", name, age);
fastformat::write(result, name, age);
result = fmt::format("{}{}", name, age);
std::stringstream sstm;
sstm << name << age;
result = sstm.str();
char numstr[21];
result = name + itoa(age, numstr, 10);
char numstr[21];
sprintf(numstr, "%d", age);
result = name + numstr;
char numstr[21];
result = name + stlsoft::integer_to_string(numstr, 21, age);
result = name + winstl::int_to_string(age);
result = name + Poco::NumberFormatter().format(age);