C++拼接String字符串 #include <iostream>#include <string>#include <sstream>using namespace std;int main(){ testFirst(); testSecond(); testThr(); return 0;}/** * 第一种C风格的转化 * * sprintf 功能强大 */void testFirst(){ char *s = "hello"; int a = 52; float b = .1314; char *buf = new char[strlen(s) + sizeof(a) + 1]; sprintf(buf, "%s%d%.