while 循环编译无法通过,麻烦帮忙看看问题在哪?
#include<stdio.h>#include<ctype.h>
int main(void)
{
int c_count,n_count,s_count;
c_count=n_count=s_count=0;
char ch;
while((ch=getchar())!='#')
{
if(isspace(ch))
s_count++;
else if(ch=='\n')
n_count++;
else
c_count++;
}
printf("total:%d%d%d\n",s_count,n_count,c_count);
return 0;
}
--------------------Configuration: e7121 - Win32 Debug--------------------
Compiling...
e7121.c
C:\Program Files\Microsoft Visual Studio\MyProjects\e7121\e7121.c(10) : error C2143: syntax error : missing ';' before 'type'
C:\Program Files\Microsoft Visual Studio\MyProjects\e7121\e7121.c(12) : error C2065: 'ch' : undeclared identifier
执行 cl.exe 时出错.
e7121.exe - 1 error(s), 0 warning(s)