资源简介
flex-2.6.4.tar.gz
代码片段和文件信息
/* A simple but fairly efficient C version of the Unix “wc“ tool */
#include
#include
main()
{
int c cc = 0 wc = 0 lc = 0;
FILE *f = stdin;
while ((c = getc(f)) != EOF) {
++cc;
if (isgraph(c)) {
++wc;
do {
c = getc(f);
if (c == EOF)
goto done;
++cc;
} while (isgraph(c));
}
if (c == ‘\n‘)
++lc;
}
done: printf( “%8d%8d%8d\n“ lc wc cc );
}
评论
共有 条评论