这是我编写的:使用了SeqStack.h堆栈,SCQueue.h队列
#include<stdio.h>
#include<conio.h>
#define MaxStackSize 100
#define MaxQueueSize 100
typedef char DataType;
#include"SeqStack.h"
#include"SCQueue.h"
void HuiWen(char []);
void main(void)
{
char string[]="aca";
clrscr();
HuiWen(string);
getch();
}
void HuiWen(char string[])
{
SeqStack myStack;
SeqCQueue myQueue;
int i,length=strlen(string);
char x,y;
StackInitiate(&myStack);
QueueInitiate(&myQueue);
for(i=0;i<length;i++)
{
StackPush(&myStack,string[i]);
QueueAppend(&myQueue,string[i]);
}
while(QueueNotEmpty(myQueue)*StackNotEmpty(myStack))
{
if(QueueDelete(&myQueue,&x)
&& StackPop(&myStack,&y)
&& x!=y)
{
printf("%s is not HuiWen\n",string);
return ;
}
}
if(QueueNotEmpty(myQueue)||
StackNotEmpty(myStack))
printf("%s is not HuiWen\n",string);
else
printf("%s is HuiWen\n",string);
}