成都创新互联网站制作重庆分公司

c++sting类在字符串中找相同的字符并且把他删除

#include
#include

int main()
{
    string str=;  //十个字符串
    string::iterator it;   //stirng 迭代
    int index=str.find("\\");
    int x=0;
    while(inedx!=-1)
    {
        if((index-1)==0)  //前面的减去后面的是1那么就是相同
        {
            it=str.begin();
            cout<<"找到相同的了"
            str.erase(it+index);
        }
        x=index;
        index=str.find("\\",index+1);
    }
    
   return 0;
}

名称栏目:c++sting类在字符串中找相同的字符并且把他删除
标题URL:http://cxhlcq.com/article/ijgphp.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部