不行··还有BUG····暂时不要用·
程序代码:
#include <stdio.h>
#include <string.h>
typedef struct node
{
char a[10];
}Qnode;
Qnode *shuru(Qnode *s)
{
Qnode* adress=s;
int i;
for(i=0;i<10;i++,s++)
gets(s->a);
return adress;
}
char * bidaxiao(Qnode s[],char *b)
{
int i;
strcpy(b,s[0].a);
for(i=1;i<10;i++)
if(strlen(b)<strlen(s[i].a))//你的算法也有问题哦! 应该选b 做比较!
strcpy(b,s[i].a);
return b;
}
int main()
{
char b[10],*c;
Qnode *p,*q,s[10];
int i;
p=s;
q=shuru(p);
c=bidaxiao(q,b);
puts(c);
return 0;
}
这按你的意思改
写的!










还是没有得到我想要的结果 得到一个最长的那个字符串。。。。。并输出。。