📜  C++ iswgraph()

📅  最后修改于: 2020-09-25 10:26:53             🧑  作者: Mango

C++中的iswgraph() 函数检查给定的宽字符是否具有图形表示。

iswgraph() 函数在头文件中定义。

iswgraph()原型

int iswgraph(wint_t ch);

iswgraph() 函数检查ch是否具有按当前C语言环境分类的图形表示形式。默认情况下,以下字符是图形:

iswgraph()参数

iswgraph()返回值

示例:iswgraph() 函数如何工作?

#include 
#include 
#include 
using namespace std;

int main()
{
    setlocale(LC_ALL, "en_US.UTF-8");
    wchar_t ch1 = L'\u0009';
    wchar_t ch2 = L'\u03a9';
    
    iswgraph(ch1)? wcout << ch1 << L" has graphical representation" : wcout << ch1 << L" does not have graphical representation";
    wcout << endl;
    iswgraph(ch2)? wcout << ch2 << L" has graphical representation" : wcout << ch2 << L" does not have graphical representation";

    return 0;
}

运行该程序时,输出为:

does not have graphical representation
Ω has graphical representation