本文介绍了ispunct判断()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 ispunct()为所有符号返回true? (比如<> / @ ^&#@等)。 Ioannis Vranos 解决方案 " Ioannis Vranos" < iv*@guesswh.at.emails.ru>一个écritdansle message de news:c7 *********** @ ulysses.noc.ntua.gr ... 我会说是。 每次返回true isstable() 和isalnum()都不返回true的可打印字符。这就是标准中所说的内容。 当我看到ispunct()时,我想到了标点符号,但我不知道它的名字是否是 是在语义上与他们相关。下面的简短程序显示哪些 可打印字符使得ispunct()返回true而那些使得 ispunct()返回false: #include< stdio.h> #include< ctype.h> int main(无效) { / *在7位ASCII表* / 形式0x20'''到Ox7E''''' br /> char c = 0x20; while(c< = 0x7E) { printf(" Is) %ca printable char与space或alphanum不同?" "%s \ n",c,ispunct(c)?" YES":NO); c + = 1; } 返回0; } Regis 是的我知道,但我猜测C99 ispunct()行为没有区别来自C ++ 98(和C90)的。 Ioannis Vranos ispunct() returns true for all symbols? (like <>/@^&#@ etc). Ioannis Vranos 解决方案 I would say yes.It returns true for every printable character for which neither isspace()nor isalnum() returns true. That''s what it is said in the standard.I think about punctuators when I see ispunct(), but I don''t know if its nameis semantically related to them. The short program below shows whichprintable characters make ispunct() returning true and those which makeispunct() returning false : #include <stdio.h>#include <ctype.h> int main(void){/* Walk through the range of printable charactersform 0x20 '' '' to Ox7E ''~'' in the 7-bit ASCII table */char c = 0x20;while(c <= 0x7E){printf("Is %c a printable char different from space or alphanum?"" %s\n",c,ispunct(c) ? "YES":"NO");c += 1;}return 0;} RegisYes i know, however i guessed that C99 ispunct() behaviour does not differfrom C++98 (and C90). Ioannis Vranos 这篇关于ispunct判断()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-27 13:19