二级C语言复习.ppt

编辑ppt #include stdio.h#include string.h#include ctype.h void getMaxLenWord(char s[],char t[])/*习题8-10 */ { int i=0,j; char sub[30]; /* 临时变量*/ strcpy(t ,); /*strset(t,\0);*/ while(s[i]!=\0){ while(s[i]== ) i++ ; /*skip the blanks */ j=0; while(isalpha(s[i])) /*save current word to sub*/ sub[j++]=s[i++]; sub[j]=\0; if(strlen(sub)strlen(t)) strcpy(t,sub); } } void main() { char str[200],t[30]; gets(str); getMaxLenWord(str,t); printf(\n\tMax length word : %s \n,t); } #include stdio.h“/*习题8-16 */ /*高位

文档评论(0)

1亿VIP精品文档

相关文档