📄 huiwen.cpp
字号:
#include "iostream"
using namespace std;
# define FALSE 0
# define TRUE 1
# define SIZE 100
typedef struct node
{
char data;
struct node *next;
}LinkStackNode;
typedef LinkStackNode *LinkStack;
int panduan(char *shu,int n)
{
LinkStackNode *top,*temp1;
char c;
int i=1;
top=(LinkStackNode *)malloc(sizeof(LinkStackNode));
if(top==NULL) return (FALSE);
top->data=shu[0];
top->next=NULL;
while (c!='&')
{
c=shu[i];
temp1=(LinkStackNode *)malloc(sizeof(LinkStackNode));
//if(top==NULL) return (FALSE);
temp1->data=c;
temp1->next=top->next;
top->next=temp1;
i++;
}
i++;
for(i;i<n;i++)
{
if(top->next==NULL)
return (FALSE);
while(top->next!=NULL)
{if(top->data==c)
{
c=shu[i];
top->next=temp1->next;
free(temp1);
i++;
}
}
}
if(top==NULL)
printf("该字符串是回文模式!\n");
else
printf("该字符串不是回文模式!\n");
return 0;
}
void main()
{
char shu[SIZE];
char c;
int i=0,j,n=0;
printf("请输入要判断的字符串:(以@结束)\n");
while(c!='@'){
c=getchar();
shu[i]=c;
i++;
n++;
}
panduan(shu,n);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -