// example-15.3.4.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int j=10;
int k=12321,p,a[10],ss;
int begin,end,i=0;
cout<<"please input "<<endl;
cin>>k;
p=k;
while (p)
{
ss=p%10;
a[i]=ss;
p=p/10;
i++;
}
begin=0;
end=i-1;
while (begin<end)
{
if(a[begin]!=a[end])
break;
else
{
begin++;
end--;
}
}
if (begin<end)
{
cout<<" false"<<endl;
}
else
{
cout<<"true"<<endl;
}
cout<<"i: "<<i<<endl;
cout<<k<<endl;
return 0;
}
回文数(整数数字)
最新推荐文章于 2022-03-24 14:17:00 发布