69,371
社区成员
发帖
与我相关
我的任务
分享
#include "stdio.h"
#define IN 1
#define OUT 0
void main()
{
int nc,nl,nw,state;
char c;
state = OUT;
nc = nl = nw = 0;
while((c=getchar())!=EOF)
{
++nc;
if(c == '\n')
{
++nl;
break;
}
if(c == ' '|| c == '\n'|| c == '\t')
state=OUT;
else if(OUT==state)
{
state=IN;
++nw;
}
}
printf("nc=%d,nl=%d,nw=%d\n",nc,nl,nw);
}
62:#define EOF (-1)