注册 登录
编程论坛 C++教室

这是我的回文的程序,可以运行,但出不来结果,希望那个高手指点哈,谢谢大家了!

王一南 发布于 2011-04-06 13:25, 380 次点击
#include <stdio.h>
#define N 20
#define ERROR -1
#define TRUE 1
typedef struct
{char elem[N];
int top[2];
}seqstack;
 int main()
 {int i,j,m,n;
  seqstack *s;
  char c;
  printf(" please input the num of the first sequence :\n");
  scanf("%d",&n);
  for( i=1;i<=n;i++)
  {printf("please input the characters:\n");
   c=getchar();
   if(c='&') continue;
   s->elem[s->top[0]]=c;
    s->top[0]++;
  }
  
   printf("input the nem of the second sequence:");
   scanf("%d",&m);
   if( m!=n) return(-1);
   if( m+n>=N) return(-1);
   for(j=1;j<=m;j++)
   {printf(" please input the characters:");
    c=getchar();
    if(c='&') continue;
    s->top[1]--;
    s->elem[s->top[1]]=c;
   }
   while (s->top[0]!=0&&s->top[1]!=0)
   {
   {while(s->elem[s->top[0]]==s->elem[s->top[1]])
   {s->top[0]--;
    s->top[1]++;
   }
    return(1 );
   }

   }
 }



2 回复
#2
王一南2011-04-07 22:25
有什么问题希望大家能指出,谢谢大家!
#3
lucky5635912011-04-08 07:57
return 0呢?
1