我晕了晕了
我查了一个小时,没看出来哪错了,我看着没错啊,到底哪错了
我的目的是删除str1中的标点.
#include<iostream>
#include<string>
using namespace std;
int main()
{
string str1=("a,b.c!d\\e/f:gh");
string str2=(",.!\\/:\"");
string::size_type pos=0;
cout<<str1<<endl;
while((pos=str1.find_first_of(str2,pos)!=string::npos))
{
str1.erase(pos,1);
pos++;
cout<<str1<<endl;
}
return 0;
}