
函数iswpunct()用于检查传递的宽字符是否为标点符号。如果不是标点符号,则返回零,否则返回非零值。它在“cwctype”头文件中声明。
以下是iswpunct()的语法:
int iswpunct(wint_t character);
这是iswpunct()的一个示例
示例
#include<cwctype>
#include<stdio.h>
using namespace std;
int main() {
wint_t a = '!';
wint_t b = 'a';
if(iswpunct(a))
printf("The character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
if(iswpunct(b))
printf("\nThe character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
return 0;
}输出
The character is a punctuation. The character is not a punctuation.
在上面的程序中,两个宽字符被声明为a和b。检查传递的字符是否为标点符号。
立即学习“C++免费学习笔记(深入)”;
wint_t a = '!';
wint_t b = 'a';
if(iswpunct(a))
printf("The character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
if(iswpunct(b))
printf("\nThe character is a punctuation.");
else
printf("\nThe character is not a punctuation.");











