返回所遇到的第一个非空白字符
这章的题,除了第一题是我自己做的外,其他的题都是求助后才做起的。。郁闷···
- C/C++ code
get_first(void){int ch;ch=getchar();while(getchar()!='\n')continue;return ch;}这个函数,修改一下,如何使其返回所遇到的第一个非空白字符呀?
[解决办法]
- C/C++ code
get_first(void){int ch;while((ch = getchar())=='\n' || ch == ' ' || ch == '\t');return ch;}