gha890826

5/6課輔-字串的基本宣告、定義、組合

May 13th, 2020 (edited)
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. //字串的基本宣告、定義、組合
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string s1;
  9.     s1="this is s1";
  10.     string s2="this is s2";
  11.     string s3="this is";
  12.     s3=s3.append(" s3");
  13.     string s4="this is";
  14.     s4+=" s4";
  15.     cout<<s1<<endl<<s2<<endl<<s3<<endl<<s4<<endl;
  16.     return 0;
  17. }
Add Comment
Please, Sign In to add comment