You can just string streams to do such a task. Note that this might not work with ancient compilers, but it's standard as of 97.
Code:
#include <sstream>
#include <string>
#include <iostream>
#include <cmath>
int main() {
float pi = 3.14159265;
double e = exp(1);
int twentyThree = 23;
char charArray[] = "deprecated";
char theLetterB = 'b';
std::ostringstream outStream;
outStream << pi << " " << e << " " << twentyThree << " " << charArray << " " << theLetterB <<
" more stuff\n";
std::string allOfEmCombined = outStream.str();
std::cout << allOfEmCombined;
return 0;
}