#include <stdio.h>
int main(){
int word,num=0;
char ch;
printf("input your text:\n");
while((ch=getchar())!=‘\n‘)
if(ch==‘ ‘)
word=0;
else if(word==0){
word=1;
num++;
}
printf("there are %d words all together\n",num);
return 0;
}
原文:https://www.cnblogs.com/p201821430005/p/10575632.html