#include<stdio.h>
void main()
{
char str[81];
int i,num=0,word=0;
char c;
printf("please input the string:/n");
gets(str);
for(i=0;(c=str[i])!='/0';i++)
{
if(c==' ')
word=0;
else if(word==0)
{
word=1;
num++;
}
}
printf("There are %d words in the line./n",num);
}
void main()
{
char str[81];
int i,num=0,word=0;
char c;
printf("please input the string:/n");
gets(str);
for(i=0;(c=str[i])!='/0';i++)
{
if(c==' ')
word=0;
else if(word==0)
{
word=1;
num++;
}
}
printf("There are %d words in the line./n",num);
}