您的位置:首页 > 其它

字符串替换,string的强大

2011-06-13 07:38 127 查看
#include"iostream"
#include"string"
using namespace std;
int main()
{
string str;
while(getline(cin,str))
{
string::size_type k;
while((k=str.find("you"))!=string::npos){
str.replace(k,3,"we");
}
cout<<str<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐