编写程序,是则输出yes,否则输出No。
#include
using namespace std;
int main()
{char s[100];
int i,j;
cout<<"请输入字符串s:"< cin>>s; for(i=0;s[i];i++); for(i--,j=0;j
if(i else cout<<"是回文串"< return 0; }
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
int Judger(char a[])
{
char *p=a;
char *q=a+strlen(a)-1;
while(p<=q)
{
if(*p!=*q)
return 0;
p++;
q--;
}
return 1;
}
main()
{
char str[100];
scanf("%s",str);
if(Judger(str))
{
printf("Yes!\n");
}
else
{
printf("No£¡\n");
}
system("pause");
}
测试数据:
LouZhuNiHao
No!
请按任意键继续. . .
AccepttpeccA
Yes!
请按任意键继续. . .
楼主好运!