ql_hw.cpp

来自「数据结构中所有算法的实现」· C++ 代码 · 共 28 行

CPP
28
字号
#include "d:\cpp\ql.cpp"
#include "d:\cpp\ss.cpp"
Bool huiwen(char con[]){
  SqStack S;
  LinkQueue Q;
  ElemType e1,e2;
  int i;
  i=0;
  InitStack(S);
  InitQueue(Q);
  while(con[i]!='\0'){
    Push(S,con[i]);
    EnQueue(Q,con[i]);
    i++;
  }//while
  while(DeQueue(Q,e1)){
    Pop(S,e2);
    if(e1!=e2)break;
  }//while
  if(!QueueEmpty(Q)) return FALSE;
  else return TRUE;
}
main(){
  char con[]="asfdsbafdsadssa";
  printf("zi fu chuan %s ",con);
  if(huiwen(con)==TRUE) printf("YES\n");
  else printf("NO\n");
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?