第1个回答 2013-07-18
#include "stdafx.h"
#include "iostream"
using namespace std;
//判断是否是回文数,是返回1,不是返回-1
int Palindromicity(int input)
{
int i = 0 ;
int Palindromicity=0;
char temp;
char c[100] = {0};
itoa(input,c,10);
for ( i = 0 ; i < strlen(c)/2;i++)
{
if ( c[i] != c[strlen(c)-i-1] )
break;
}
if( i == strlen(c)/2)
return 0;
else
return -1;
}
int _tmain(int argc, _TCHAR* argv[])
{
int count=0,i=0;
for( i = 10000 ; i<50000;i++)
{
if (Palindromicity(i) == 0 )
{
cout<<i<<" ";
count++;
if (count%5 == 0)
cout<<endl;
}
}
getchar();
return 0;
}本回答被网友采纳