我试图从 std:::string in C++. 中删除所有标点字符。 我目前的代码 :
string str_in;
string::size_type i, j;
cout << "please input string with punctuation character..." << endl;
cin >> str_in;
for (i = 0, j = 0; i != str_in.size(); ++i)
if (!ispunct(str_in[i]))
str_in[j++] = str_in[i];
str_in[j] = ;
cout << str_in << endl;
str_in[j] = ;
错误吗?