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 简短祝福语毛笔字