标题:统计单词个数问题
取消只看楼主
nowander
Rank: 1
等 级:新手上路
帖 子:7
专家分:1
注 册:2011-11-11
结帖率:100%
已结贴  问题点数:5 回复次数:0 
统计单词个数问题
#include <stdio.h>
#define IN 1
#define OUT 0
/* count lines, words, and characters in input */
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);
getch();
}
————————————————————————————————————
报错:需要逻辑0或非0在main函数中,什么意思,编译软件问题??
搜索更多相关主题的帖子: 单词 统计 include count 
2011-11-19 16:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-355688-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.168213 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved