返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. #include<algorithm>
  5. using namespace std;
  6. int main()
  7. {
  8.         string str1="honolulu";
  9.         cout<<str1.replace(0,2,"de")<<endl;
  10.        
  11.         string str2="sdfjieajihs";
  12.         cout<<str2.replace(str2.find("f"),1,"e")<<endl;
  13.        
  14.         string str3="soejodofoeodfoo";
  15.         replace(str3.begin(),str3.end(),'o','b');
  16.         cout<<str3<<endl;
  17.         system("pause");
  18.         return 0;
  19. }
複製代碼

TOP

返回列表