#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>
void main()
{
system("color f0");
char string[100];
int a,b,i,len,choice=1,flag;
while(choice)
{
system("cls");
printf("请输入您想判断的回文:");
gets(string);
len=strlen(string);
len--;
for(i=0;i<=len/2;){
unsigned char ch = string[i];
if(ch > 0x8E && ch < 0xFF)
{
a=i;b=len-i;
unsigned tchar1=string[a];
unsigned tchar2=string[a+1];
unsigned tchar3=string[b];
unsigned tchar4=string[b-1];
if(tchar1==tchar4&&tchar2==tchar3)
flag=1;
else
{
flag=0;
break;
}
i+=2;
}
else
{
a=i;b=len-i;
if(string[a]==string[b])
flag=1;
else
{
flag=0;
break;
}
i++;
}
}
if(flag) printf("是回文\n");
else printf("不是回文\n");
printf("继续按1 ; 退出按0。\n");
scanf("%d",&choice);
fflush(stdin);
}
}