- #include<iostream>
- #include<cstdlib>
- #include<string>
- #include<algorithm>
- using namespace std;
- int main(){
- string str1="efkiusef";
- cout<<str1.replace(5,3,"a")<<endl;
-
- string str2="efkiusef";
- cout<<str2.replace(str2.find("u"),1,"a")<<endl;
-
- string str3="efkiusef";
- replace(str3.begin(),str3.end(),'u','a');
- cout<<str3<<endl;
-
- system("pause");
- return 0;
- }
複製代碼 |