std::string strval;
strval = "hello world";
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
std::string str1, str2, str3, str4;
str1 = "hello";
str2 = "cpp";
str3 = "world";
str4 = str1 + " " + str2 + " " + str3;
cout << "Press enter to continue" << endl;
cin.get();
cout << str4 << endl;
return 0;
}
$ ./strtest
Press enter to continue
hello cpp world
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |