大家帮我看一下这个程序,为什么运行不对啊?
#include<stdio.h>
int main()
{
int zm ,danc, hangshu;
zm=danc=hangshu=0;
char str[100], c;
bool ident = false;
printf("Please input a sentence:\n");
gets(str);
while((c=getchar())!=EOF)
{
++zm;
if(c=='\n')
++hangshu;
if(c==' '||c =='\n'||c=='\t')
ident=false;
else if(ident==false)
{
ident=true;
++danc;
}
}
printf("%s=%d\n%s=%d\n%s=%d\n",
"zm",zm,
"hangshu",hangshu,
"danc",danc);
return 0;
}