# include
# include
void daozhi(char str[])
{ int i,n;
char c,*s=str;
for(n=0;s[n]!='\0';)
n++;
printf("n=%d\n",n);
for(i=0;i<=n/2;i++)
{ c=str[i];
str[i]=str[n-i-1];
str[n-i-1]=c;
}
}
void main()
{ char str1[100],str2[100];
int a;
gets(str1);
strcpy(str2,str1);
daozhi(str2);
a=strcmp(str1,str2);
if(a==0)
printf("%s是回文\n",str1);
else
printf("%s不是回文\n",str1);
return 0;
}
#include "stdio.h"
#include "string.h"
#include "conio.h"
main()
{
long num ,w,suw =0;
int i = 0;
int j;
int a[15];
scanf("%d",&num);
w = num;
do
{
a[i] = num%10;
num =num/10;
i++;
}while(num/10>0);
a[i] = num;
j = i;
for(i = 0 ;i <= j;i++)
{ // printf("%d\n",a[i]);
suw =suw*10+ a[i];
}
//printf("%d,%d\n",num,suw);
if(suw == w)
printf("yes\n");
else
printf("no\n");
getch();
}
用的是dev c++编写的,你看对不?
那不简单,按你自己说的判断撒。
#include
#include
int main()
{
const int size=15;
char a[size];
int len,i,is=1;
cin.getline(a,size );
len=strlen(a);
for(i=0;i
is=0;
break;}
if(is==1)
cout<<"The input is"<
cout<<"The is not"<
return 0;
}