输出的结果为什么不是二呢

img


统计键盘输入的单词数,为什么结果不对,输出了字符的数量呢,望解答

#include<stdio.h>
#include<stdbool.h>
#include<ctype.h>
int main(){
char c=0;
bool isprime=false;
int num=0;
while((c=getchar())!='\n'){
    if(c==' '){
        isprime=true;

    }else if(isalpha(c)&&(isprime)){
        isprime=!isprime;
        num++;
    }
}
printf("%d\n",num+1);
return 0;
}

你的思路似乎有点问题,是否是用空格判断单词的个数

15行后面的分号删掉