方法一,使用+运算符:
#include
string str;
string str2 = "123", str3 = "456";
str = str2 + str3
cout<
#include
char str[200];
char str2[] = "123", str3[] = "456";
sprintf(str,"%s%s",str2,str3);
cout<
用string
string a="123";
string b="456"
string c=a+b;
用+就可以拼接了。
方法1:
#include
string str;
string str2 = "123", str3 = "456";
str = str2 + str3
cout<
#include
char str[200];
char str2[] = "123", str3[] = "456";
sprintf(str,"%s%s",str2,str3);
cout<