C/C中的iswcntrl()函数++

这个 iswcntrl() 是C++中的一个内置函数,它检查给定的宽字符是否为控制字符。它是在 cwctype C/C++的头文件。

null

语法:

int iswcntrl(wint_t ch)

参数: 该函数只接受一个强制参数 中国 它指定了宽字符,我们必须检查它是否是控制字符。

返回值: 该函数返回两个值,如下所示:

  • 如果 中国 是一个控制字符,则返回一个非零值。
  • 如果不是,则返回0。

下面的程序说明了上述功能。 项目1:

// C++ program to illustrate the
// iswcntrl() function
#include <bits/stdc++.h>
using namespace std;
int main()
{
wchar_t ch1 = L '' ;
// checks if it is a control character
if (iswcntrl(ch1))
wcout << "It is a control Character" ;
else
wcout << "It is not a control Character" ;
return 0;
}


输出:

It is a control Character

项目2:

// C++ program to illustrate the
// iswcntrl() function
#include <bits/stdc++.h>
using namespace std;
int main()
{
wchar_t ch1 = L '@' ;
// checks if it is a control character
if (iswcntrl(ch1))
wcout << "It is a control Character" ;
else
wcout << "It is not a control Character" ;
return 0;
}


输出:

It is not a control Character

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享