Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //字串合併、子字串
- #include <iostream>
- using namespace std;
- int main()
- {
- string s1="this is s1",s2="this is s2";
- char c3[5]="char";
- cout<<"s1+s2:"<<s1+s2<<endl;
- cout<<"s1+c3:"<<s1+c3<<endl;
- s1+=c3;
- cout<<"s1+=c3:"<<s1<<endl;
- s2.append(c3);
- cout<<"s2.append(c3):"<<s2<<endl;
- cout<<"substr():"<<s1.substr(0,4);
- return 0;
- }
Add Comment
Please, Sign In to add comment