[C++] c++ 连接使用STL字符串 →→→→→进入此内容的聊天室

来自 , 2019-12-22, 写在 C++, 查看 166 次.
URL http://www.code666.cn/view/ff1418e8
  1. // 连接使用STL字符串
  2. #include <string>
  3. #include <iostream>
  4.  
  5. int main() {
  6.         using namespace std;
  7.  
  8.         string strSample1("Hello");
  9.         string strSample2(" String!");
  10.  
  11.         // Concatenate
  12.         strSample1 += strSample2;
  13.         cout << strSample1 << endl << endl;
  14.  
  15.         string strSample3(" Fun is not needing to use pointers!");
  16.         strSample1.append(strSample3);
  17.         cout << strSample1 << endl << endl;
  18.  
  19.         const char* pszConstString = "You however still can!";
  20.         strSample1.append(pszConstString);
  21.         cout << strSample1 << endl;
  22.  
  23.         return 0;
  24. }
  25.  

回复 "c++ 连接使用STL字符串"

这儿你可以回复上面这条便签

captcha