使用append
string s1 = "Hello ";
string s2 = "World! ";
string s3 = " China";
string s4;
s4.append(s1);
cout<<s4.c_str()<<endl;
s4.append(s2);
cout<<s4.c_str()<<endl;
s4.append(s3);
cout<<s4.c_str()<<endl;
网友评论