C++中字符串相加

将字符串 s1 = "武当派"与字符串 s2 = "张三丰"相加:

demo:
#include
#include
#include

using namespace std;

int main(void) {
	string s1 = "武当派";
	string s2 = "张三丰";
	string s3;

	s3 = s1 + s2;//字符串s1与字符串s2相加,赋值给s3
	cout << "s3=" << s3 << endl;

	system("pause");
	return 0;
}

输出为:
s3=武当派张三丰

你可能感兴趣的:(c++,c语言,c++)