📅  最后修改于: 2020-09-25 07:04:12             🧑  作者: Mango
int isgraph(int ch);
isgraph()
函数检查ch
是否具有按当前C语言环境分类的图形表示形式。默认情况下,以下字符是图形:
如果ch
的值不能表示为无符号字符或不等于EOF,则isgraph()
的行为是不确定的。
它在
ch
:要检查的字符 。
如果ch是图形的,则isgraph() 函数返回非零值,否则返回零。
#include
#include
using namespace std;
int main()
{
char ch1 = '$';
char ch2 = '\t';
isgraph(ch1)? cout << ch1 << " has graphical representation" : cout << ch1 << " does not have graphical representation";
cout << endl;
isgraph(ch2)? cout << ch2 << " has graphical representation" : cout << ch2 << " does not have graphical representation";
return 0;
}
运行该程序时,输出为:
$ has graphical representation
does not have graphical representation