菜菜求解
我在vc6中文企业版做的,在dev-c4.9.9.2也做了,都无法编译,说是有一处错误。可是我找不出来,麻烦各位大侠了!#include <stdio.h>
#include <ctype.h>
#include <stbool.h>
#include <windows.h>
int main (void)
{
char c;
char prev;
long n_chars=0L;
int n_lines=0;
int n_words=0;
int p_lines=0;
bool inword=1;
printf ("Enter text to be analyzed:\n");
prev='\n';
while ((c=getchar())!=EOF)
{
n_chars++;
if(c=='\n')
n_lines++;
if(!isspace(c)&&!inword)
{
inword=0;
n_words++;
}
if(isspace(c)&&inword)
inword=1;
prev=c;
}
if(prev!='\n')
p_lines=1;
printf("characters=%ld,words=%d,lines=%d,",n_chars,n_words,n_lines);
printf(partial lines=%d\n",p_lines);
return 0;
}