免费购物网站,阿里云建网站流程,wordpress 图片目录,网站建设专c语言函数库——ispunct函数 判断字符是否为标点符号或特殊字符
头文件#xff1a;#inlude ctype.h spunct() 函数用来检测一个字符是否为标点符号或特殊字符#xff0c;其原型为#xff1a; int ispunct(int c); 【参数】c 为需要检测的字符。 【返回值】若 c 为标…c语言函数库——ispunct函数 判断字符是否为标点符号或特殊字符
头文件#inlude ctype.h spunct() 函数用来检测一个字符是否为标点符号或特殊字符其原型为 int ispunct(int c); 【参数】c 为需要检测的字符。 【返回值】若 c 为标点符号或特殊符号非空格、非数字和非英文字母返回非 0 值否则返回 0。
#includebits/stdc.h
using namespace std;
int main()
{int number0;string str123.456?789;for(int i0;istr.length();i){if(ispunct(str[i])){number;}}cout特殊字符或标点的数量为numberendl;return 0;
}