从p83开始写,这一章前面的丢了看书就好
使用范围for语句和ispunc函数来统计string对象中标点符号的个数:
string s(“hello World”);
decltype(s.size())punct_cnt=0;
for(auto c:s)
if(ispunct(c))
++punct_cnt;
cout<<punct_cnt
<<"punctuation characters in"<<s<<endl;
使用decltype关键字声明计算变量punct_cnt,
使用范围for语句和ispunc函数来统计string对象中标点符号的个数:
string s(“hello World”);
decltype(s.size())punct_cnt=0;
for(auto c:s)
if(ispunct(c))
++punct_cnt;
cout<<punct_cnt
<<"punctuation characters in"<<s<<endl;
使用decltype关键字声明计算变量punct_cnt,