- #include <stdio.h>
- #include <string.h>
- int total_days(int y,int m,int d);
- int main()
- {
- int i,len = 0,maxlen = 0;
- char *p,*pt,s[1024],subs[100];
- printf("请输入字符串: ");
- gets(s);
- for(pt = s;*pt != '\0';pt++) //遍历字符串;
- {
- if((*pt != ' ') &&(*pt != '\0')) //找出空格位;
- len++;
- else if(len>maxlen)
- {
- maxlen=len;
- p = pt - len;
- len=0;
- }
- }
- for(i = 0;i < maxlen;i++)
- subs[i] = *(p + i);
- subs[maxlen] = '\0';
- printf("长英文词:%s,\n",subs);
- return 0;
- }
复制代码
|