punctuation.cpp
来自「C++ primer 书中例题代码puncutation」· C++ 代码 · 共 14 行
CPP
14 行
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
string s("Hello World!!");
string::size_type punct_cnt = 0;
for(string::size_type index = 0; index != s.size(); ++index)
if(ispunct(s[index]))
++punct_cnt;
cout << punct_cnt << " punctuations characters in " << s << endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?