//快采纳给分吧
Enter the string
who is your daddy?
The new string is:wiyd
Press any key to continue
#include
#include
main()
{
char str[81],s[20],c;
int i,j,word=0;
printf("Enter the string\n"); gets(str);
i=0;j=0;
while((c=str[i])!='\0')
{
if(c==' ') /*空格表示单词结束*/
word=0;
else if(c!=' '&& word==0)
{
word=1;
s[j++]=c;
}
i++;
}
s[j]='\0';
printf("The new string is:%s\n",s);
}
只要输出单词首字符组成的字符串,还是每个单词也要输出来?