C / C ++中的iswdigit()函数
该函数iswdigit()是C/C++中的内置函数。它检查宽字符是否为十进制数字。在C++语言中的“cwctype”头文件中声明,而在C语言中的“ctype.h”中声明。它采用单个字符,称为宽字符。
从0到9的字符被分类为十进制数字。如果宽字符不是数字,它将返回零。如果字符是数字,它将返回非零值。
这是iswdigit()C++语言的语法,
int iswdigit(ch)
这是iswdigit()C++语言的示例,
示例
#include <cwctype>
#include <iostream>
using namespace std;
int main() {
wchar_t c1 = '!';
wchar_t c2 = '8';
if (iswdigit(c1))
wcout << c1 << " , The character is a digit ";
else
wcout << c1 << " , The character is not a digit ";
wcout << endl;
if (iswdigit(c2))
wcout << c2 << ", The character is a digit ";
else
wcout << c2 << ", The character is not a digit ";
return 0;
}输出结果
! , The character is not a digit 8 , The character is a digit
热门推荐
10 香港老妈结婚祝福语简短
11 毕业立体贺卡祝福语简短
12 简短新年年会祝福语
13 评论小品祝福语大全简短
14 恭喜师兄结婚祝福语简短
15 员工集体辞职祝福语简短
16 高中新生祝福语 简短
17 装修祝福语男生搞笑简短
18 生日开业蛋糕祝福语简短