#include <stdio.h>
int main (void)
{
char string[81];
int i, num=0, word=0;
char c;
gets (string);
for (i=0; (c=string[i])!='\0'; i++)
if (c==' ') word=0;
else if (word==0)
{
word=1;
num++;
}
printf ("There are %d words in the line.\n", num);
return 0;
}
在DEV中运行一闪而过. 这是为什么?
[此贴子已经被作者于2006-5-6 17:56:50编辑过]