c++sting类在字符串中找相同的字符并且把他删除-成都快上网建站

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类在字符串中找相同的字符并且把他删除
本文网址:http://kswjz.com/article/ijgphp.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流