#include<iostream> #include<string> 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; }
时间: 2024-08-25 10:36:38