Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //字串的長度、大小
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string s1="this is s1";
- cout<<s1[2]<<endl;
- cout<<"length():"<<s1.length()<<endl;
- cout<<"size():"<<s1.size()<<endl;
- cout<<"sizeof():"<<sizeof(s1)<<endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment