//1.
int i;
int num;
int word;
char c;
char str[81];
//2.
i=0;
num=0;
word=0;
//3.
gets(str);//读入一个字符串
//4.
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 this line.\n",num);
printf("Hello World!\n");
return 0;
int i;
int num;
int word;
char c;
char str[81];
//2.
i=0;
num=0;
word=0;
//3.
gets(str);//读入一个字符串
//4.
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 this line.\n",num);
printf("Hello World!\n");
return 0;