成语大全网 - 成语解释 - 程序调用词典释义

程序调用词典释义

#include?<stdio.h>

#include?<string.h>

#include?<ctype.h>

char?*biggest(char?str[],char?max[])?{

int?i?=?0,j;

char?word[100];

max[0]?=?'\0';

while(str[i])?{

while(str[i]?&&?!isalpha(str[i]))?++i;?//?滤除非字母字符

j?=?0;

while(isalpha(str[i]))?//?开始读取单词

word[j++]?=?str[i++];

word[j]?=?'\0';

if(strcmp(word,max)?>?0)?strcpy(max,word);

}

if(j?>?0)?{

word[j]?=?'\0';

if(strcmp(word,max)?>?0)?strcpy(max,word);

}

return?max;

}

int?main()?{

char?str[100],word[100];

printf("please?input?a?sentence:\n");

gets(str);

printf("最大单词是:%s\n",biggest(str,word));

return?0;

}