注册 登录
编程论坛 C++教室

这个代码麻烦帮我看一下哪里错,谢谢了,,,,是要输出不是标点符号的字符

小兵打将 发布于 2011-07-22 00:44, 334 次点击
# include <iostream>
# include <cctype>
# include <string>
using namespace std;
void main()
{
    string s1;
    cin >> s1;
    for(string::size_type index=0,inde_x=0;index<s1.size();++index)
    {
        if(!ispunct(s1[index]))
            s2[++inde_x]=s1[index];
    }
}

1 回复
#2
lucky5635912011-07-22 08:34
s2没有定义,inde_x写错了。
1