64,682
社区成员
发帖
与我相关
我的任务
分享
int main()
{
string st("Hello Word!!!");
string::size_type punct=0;
for (string::size_type index=0;index!=st.size();++index)
if (ispunct(st[index]))
{
++punct;
}
cout<<punct<<endl;
return 0;
}
st.size() //st中字符串个数。不算是抽象吧。