首页 > 其他 > 详细

字符串替换

时间:2015-08-09 10:59:36      阅读:198      评论:0      收藏:0      [点我收藏+]
#include <iostream>using namespace std;#include <cstring>int main()
{
 charstr[1010]; while(gets(str))
 {
  inti;  for(i=0;i<strlen(str);i++)
  {   if(str[i]==‘y‘&&str[i+1]==‘o‘&&str[i+2]==‘u‘)
   {    cout<<"we";
    i+=2;
   }   else
   cout<<str[i];
  }  cout<<‘\n‘;
 }
 return0;
}


本文出自 “桑海田 博客专栏” 博客,请务必保留此出处http://10602803.blog.51cto.com/10592803/1682972

字符串替换

原文:http://10602803.blog.51cto.com/10592803/1682972

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!