返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. using namespace std;

  5. int main() {
  6.     string str = "9876543210";
  7.     cout << "原字串:" << str << endl;
  8.     cout<<str.substr(5)<<endl;
  9.     cout<<str.substr(2)<<endl;  
  10.     cout<<str.substr(3,3)<<endl;  
  11.     cout<<str.substr(7,1)<<endl;
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

TOP

返回列表