输入中第一个空格怎么去掉
#include<stdio.h>#include<string.h>
int main()
{
char words[100];
int i,flag;
int num=0;
gets(words);
if(strlen(words)>=100)
return -1;
for(i=0;words[i]!='\0';i++)
{ if(words[i]==' ') flag=0;
else if(flag==0)
{
flag=1;
num++;
}
}
printf("there are %d words in %s\n",num,words);
return 0;
}