这个 iswctype() 是C/C++中的一个内置函数,用于检查给定的宽字符是否具有特定属性。它是在 cwctype C/C的头文件++
null
语法:
int iswctype(wint_t wc, wctype_t desc)
参数: 该函数接受两个强制参数,如下所述:
- 厕所 –要检查的宽字符。
- 描述 –要测试的属性,该属性是通过调用wctype()获得的。
返回值: 该函数返回两个值,如下所示:
- 如果 厕所 具有指定的属性 描述 ,然后返回一个非零值。
- 否则返回零。
下面的程序说明了上述功能。
项目1:
// Program to illustrate // iswctype() function #include <bits/stdc++.h> using namespace std; int main() { wchar_t wc = L 'A' ; // checks if the type is digit if (iswctype(wc, wctype( "digit" ))) wcout << wc << L " is a digit" ; // checks if the type is alpha else if (iswctype(wc, wctype( "alpha" ))) wcout << wc << L " is an alphabet" ; else wcout << wc << L " is neither " << "an alphabet nor a digit" ; return 0; } |
输出:
A is an alphabet
项目2:
// Program to illustrate // iswctype() function #include <bits/stdc++.h> using namespace std; int main() { wchar_t wc = L '5' ; // checks if the type is digit if (iswctype(wc, wctype( "digit" ))) wcout << wc << L " is a digit" ; // checks if the type is alpha else if (iswctype(wc, wctype( "alpha" ))) wcout << wc << L " is an alphabet" ; else wcout << wc << L " is neither" << " an alphabet nor a digit" ; return 0; } |
输出:
5 is a digit
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END