#define IN 1 /* 在单词内 */
#define OUT 0 /* 在单词外 */
/* 统计输入的行数、单词数与字符数 */
main ( )
{
int c, nl, nw, nc, state;
state = OUT;
nl = nw = nc = 0;
while ( (c = getchar ( ) ) != EOF ) {
++nc;
if ( c =='\n' )
++nl;
if ( c == ' ' ||c == '\n' || c == '\t' )
state = OUT;
else if ( state == OUT ) {
state = IN;
++nw;
}
}
printf("%d %d %d\n", nl, nw, nc);
}
在linux上面有gcc编译完运行 然后我输入字符....就不知道怎样退出这个程序看结果了....急 在线等


huangqimin4 于 2008-02-28 15:51:41发表:
ctrl+c
yunlerini 于 2008-02-28 15:01:11发表:
嗯 谢谢你 ~~~
xiaoqianqian 于 2008-02-28 14:55:52发表:
ctrl+d
yunlerini 于 2008-02-28 14:36:25发表:
自己顶下 大家来帮帮忙啊