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

  6. int main()
  7. {
  8.     string a1="bengchiling";
  9.     cout<<a1<<endl;
  10.     cout<<a1.replace(4,1,"Z")<<endl;
  11.     string a2="bengchiling";
  12.     cout<<a2.replace(a2.find("g"),1,"QQ")<<endl;
  13.     cout<<a2.replace(a2.find("g"),1,"QQ")<<endl;
  14.     string a3="bengchiling";
  15.     replace(a3.begin(),a3.end(),'n','o');
  16.     cout<<a3<<endl;
  17. }
複製代碼

TOP

返回列表