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%.4f", s, a, b); printf("%s\n", buf);}/** * 半C半C++风格 */void testSecond(){ string s = "dong"; int a = 520; //2147483647 in